我正在使用TwythonStream计算,并试图得到一个计数的例子,一个部分刺痛被发现。下面的代码运行,但每个实例的计数器保持为1。作为一个Python NOOB,任何帮助或建议都是值得的
from twython import TwythonStreamer
class myStream(TwythonStreamer):
def on_success(self, data):
if 'text' in data:
counter = counter + 1
print("found %d" % counter)
if counter == 3:
print("Found three!")
self.disconnect()
目前没有回答
相关问题 更多 >
编程相关推荐