我在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