2016-06-08 57 views
0

在tweepy streamListener中,“def on_data(self,data):”和“def on_status(self,status):”有什么区别?在tweepy streamListener中,“def on_data(self,data):”和“def on_status(self,status):”有什么区别?

喜,在tweepy documentation 他们使用高清on_status流媒体:

import tweepy 
class MyStreamListener(tweepy.StreamListener): 
    def on_status(self, status): 
    print(status.text) 

this tutorial使用高清on_data流媒体:

from tweepy import Stream 
from tweepy.streaming import StreamListener 

class MyListener(StreamListener): 
    def on_data(self, data): 

的区别是什么?

+0

只是说明一下,当一个字段表示“在此处输入链接描述”时,系统会要求您实际输入内容,而不是仅保留默认文本;-) –

回答

0

阅读第一个链接。 “差异”是一个发生在另一个之前。

Tweepy的StreamListener的on_data方法方便地将数据从状态传递到on_status方法。

相关问题