如何获取帐户的最后一条推文

How to get the last tweets of an account

我正在编写一个脚本,用于查找 Twitter 用户的最后一条推文。

我正在使用 tweepy,我知道这个答案有效

但是它也会打印用户的回复。 我只想知道一个人发送的实际推文

tweetL = api.user_timeline(screen_name='elonmusk', tweet_mode="extended")
print(tweetL[0].full_text)

我该怎么做,有相应的功能吗?

您可以向 user_timeline 函数传递一个额外的参数,它被称为 exclude_replies

请查看 documentation 以了解该函数的所有可能参数。