这是我的密码
def mentionsGrabber():
#if user wants to scan mentions for a certin phrase then save the tweet that contains the phrase into a txt file
mentions = api.mentions_timeline()
#variables
for tweet in mentions:
#checks mentions
global keyword
global replySave
keyword = input("what word would you like to search for? | ")
replySave = input("what '.txt' file would you like to save results too? | ")
#user inputs
tweetText = tweet.text
keywordFind = tweetText.find(keyword)
#finding tweet and finding keyword in tweet
if keywordFind >= 0:
fin = open(replySave, "wt")
fin.write(tweetText)
fin.close()
我想能够添加多个tweet到txt文件,而不要求每次搜索词和保存位置。现在,每当我开始它,有多个提到,它要求我为每一个提到的关键字
目前没有回答
相关问题 更多 >
编程相关推荐