正确打开方式应该加上encoding='utf-8-sig'
代码
import csv
data = [['American','美国人'],
['Chinese','中国人']]
with open('results.csv','w',newline='',encoding='utf-8-sig') as f:
w = csv.writer(f)
w.writerows(data)
正确打开方式应该加上encoding='utf-8-sig'
代码
import csv
data = [['American','美国人'],
['Chinese','中国人']]
with open('results.csv','w',newline='',encoding='utf-8-sig') as f:
w = csv.writer(f)
w.writerows(data)