Python写入中文到csv,防止乱码的方法

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,防止乱码的方法)