如何解决Python:无法修复此索引错误以获取推文
我正在尝试将推文下载到 csv 中以训练机器人,但我遇到了这个 Indexerror。 错误在最后一行:
def download_tweets(
username=None,limit=None,include_replies=False,include_links=False,strip_usertags=False,strip_hashtags=False,# If a limit is specificed,validate that it is a multiple of 20
if limit:
assert limit % 20 == 0,"`limit` must be a multiple of 20."
# If no limit specifed,estimate the total number of tweets from profile.
else:
c_lookup = twint.Config()
c_lookup.Username = username
c_lookup.Store_object = True
c_lookup.Hide_output = True
if include_links is True:
c_lookup.Links = "include"
else:
c_lookup.Links = "exclude"
twint.run.Lookup(c_lookup)
limit = twint.output.users_list[-1].tweets
错误信息:在下载推文中 limit = twint.output.users_list[-1].tweets 索引错误:列表索引超出范围
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。