使用Twitter API收集推文时出现错误

时间:2019-05-13 08:20:40

标签: python twitter twitter-search

我正在使用tweetminer从此网站收集推文: https://github.com/kshaffer/tweetmineR

但是当我使用twitter_search.py​​运行搜索时 我得到那些错误:

<undefined>
'charmap' codec can't encode character '\u06cc' in position 196: character maps to <undefined>
'charmap' codec can't encode character '\U0001f43c' in position 88: character maps to <undefined>
'charmap' codec can't encode character '\u06cc' in position 210: character maps to <undefined>

它们并不是完全错误,但是搜索将继续。但是,有很多都印在控制台上。如何解决它们?

1 个答案:

答案 0 :(得分:2)

每次使用encoding='utf-8'时,您都可以尝试添加参数open()(第41和48行)。或将.encode('utf-8')应用于您收集的推文。