【发布时间】:2013-08-17 01:13:04
【问题描述】:
我正在encoding UTF-16 模式下打开文本文件:
with open(file.txt, 'r', encoding="UTF-16") as infile:
然后我想写入一个excel文件:
from csv import writer
excelFile = open("excelFile_1.csv", 'w', newline='')
write = writer(excelFile, delimiter=',')
write.writerows([[input]])
其中input 是文本文件file.txt 中的一个术语
我收到以下错误
UnicodeEncodeError: 'charmap' codec can't encode character '\xe9' in position 113: character maps to <undefined>
使用 Python 3.2
【问题讨论】:
标签: python csv unicode python-3.x