我在 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])
给定的数据被转换为“????????????” 有什么办法可以解决这个问题吗?
可以使用 CSV UTF-8(.csv) 格式保存 CSV 文件。感谢您的回复。