【发布时间】:2013-03-11 07:48:30
【问题描述】:
使用 tweepy 我们可以按位置和多个位置搜索推文,例如:
stream.filter(locations=[-122.75,36.8,-121.75,37.8,-74,40,-73,41], track=terms)
但是,当我尝试将来自 NY 的所有推文放在一个列表中并将来自 SF 的推文放在另一个列表中时,我无法将它们分配到任一列表中。这是我的代码片段:
NY = 74,40,-73,41
NewYorkCNN = []
if status.coordinates == NY or status.place == 'New York':
for term in terms:
if term in status.text:
NewYorkCNN.append(term)
如何正确地将它们放在正确的列表中?
【问题讨论】:
-
如果问题仍未解决,能否提供您正在使用的完整代码?
标签: python python-2.7 twitter tweepy