import csv
data = [['American','美国人'],
['Chinese','中国人']]
with open('results.csv','w',newline='',encoding='utf-8-sig') as f:
w = csv.writer(f)
w.writerows(data)
import csv
data = [['American','美国人'],
['Chinese','中国人']]
with open('results.csv','w',newline='',encoding='utf-8-sig') as f:
w = csv.writer(f)
w.writerows(data)
本文标题:Python写入中文到csv,防止乱码的方法
本文链接:https://www.haomeiwen.com/subject/ipagkqtx.html
网友评论