【问题标题】:Errors when I collect tweets using twitter API使用 twitter API 收集推文时出错
【发布时间】:2019-05-13 08:20:39
【问题描述】:

我正在使用 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>

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

【问题讨论】:

    标签: python twitter twitter-search


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-10-16
      • 1970-01-01
      • 2016-06-29
      • 2018-02-12
      • 2016-07-22
      • 1970-01-01
      • 1970-01-01
      • 2016-02-18
      相关资源
      最近更新 更多