使用 twython 记录在特定日期发布有关特定关键字的用户的所有屏幕名称

问题描述

我正在尝试使用 Twython 打印在搜索结果中找到的所有屏幕名称

这是我当前的代码

#Import the required modules
from twython import Twython

#Setting the OAuth
Consumer_Key = ''
Consumer_Secret = ''
Access_Token = '-'
Access_Token_Secret = ''

#Connection established with Twitter API v1.1
twitter = Twython(Consumer_Key,Consumer_Secret,Access_Token,Access_Token_Secret)

#Twitter is queried
response = twitter.search(q='Roblox',since='2017-02-25',until='2017-02-26')

for tweet in response["statuses"]:
    st = tweet["entities"]["user_mentions"]
    screen_name = st[0]["screen_name"]
    f = open("output.txt","a")
    f.write(str(screen_name,",\n"))
    print(screen_name)
    f.close()

但它不在日志文件中编辑或打印。就在我启动它时,程序停止并没有明显错误

代码已经填好,只是为了帖子删除了)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)