首页 > 解决方案 > 未定义字符的 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

标签: pythonpython-3.xunicodeencodingtwilio

解决方案


推荐阅读