Python 如何提取在tweepy中创建api.search返回的推文的用户?
我试图搜索包含指定标签的tweet,然后获取创建tweet的用户Python 如何提取在tweepy中创建api.search返回的推文的用户?,python,tweepy,Python,Tweepy,我试图搜索包含指定标签的tweet,然后获取创建tweet的用户 import tweepy tweets = tweepy.Cursor(api.search, q="python", tweet_mode='extended').items() while True: tweet = next(tweets) for hashtag in tweet.entities.get('hashtags'): ht = hashtag['text']
import tweepy
tweets = tweepy.Cursor(api.search, q="python", tweet_mode='extended').items()
while True:
tweet = next(tweets)
for hashtag in tweet.entities.get('hashtags'):
ht = hashtag['text']
# process the hashtag...
# who is the user that created this tweet?
user = ???
如何从
tweet
对象中提取用户?您可以查看用户
对象的名称
属性或屏幕名称
属性,以找出谁发布了tweet
print(tweet.user.name)
print(tweet.user.screen_name)
例如,我在推特上的名字是蜥蜴比尔,但在屏幕上的名字是