python - 未定义字符的 Unicode 编码错误
问题描述
我正在使用 Python 3 并试图将一串 Twillio 聊天消息附加到列表中,但收到此错误。我知道编码在 python3 中不再工作,并且正在通过 atom 运行它,因为人们说 IDLE 可能会导致错误。
text=[]
messages = client.messages.list()
for record in messages:
print(record.body)
text.append(record.body)
print(text)
错误:
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character
'\U0001f680' in position 71: character maps to undefined
解决方案
推荐阅读
- gnuplot - Gnuplot:如何显示超过 24 小时?
- javascript - 如何正确使用 createPages API 以编程方式创建页面?
- java - 如何设置 onItemClickListener
- javascript - 我可以在原型方法中修改字符串的内容吗?
- reactjs - 在状态更改时一次仅显示一个弹出窗口
- c# - 调试输出窗口一遍又一遍地显示“启动线程”和“停止线程”
- python - 如何修复“Spider 必须返回 Request、BaseItem、dict 或 None,被‘设置’在......”
- python - 刷新python瓶中的页面时数据似乎没有更新?
- python - 如何从 CSV 文件创建具有一个键和多个值的字典?
- grep - Grep 匹配模式但排除特定字符串