无法通过csv读取Excel中的本地语言数据
我在一个CSV文件里写了数据,内容是“यह एक नमूना संदेश है”。我用Python的CSV模块来读取这个文件里的数据。
csvFile = request.FILES.get('file')
csv_copy = copy.deepcopy(csvFile)
file_content = csv_copy.read()
decoded_file = file_content.decode('utf-8').splitlines()
reader = csv.reader(decoded_file)
rows = list(reader)
for i,row in enumerate(rows):
print(row[1])
但是读取出来的数据变成了“???? ???? ???”。请问有什么办法解决这个问题吗?
1 个回答
0
保存CSV文件时选择了CSV UTF-8(.csv)格式,成功了。谢谢你的回复。