Python 如何将中文写入csv文件
import unicodecsv as ucsv
data = [[u"列1", u"列2"], [u"内容1", u"内容2"]]
with open(‘test.csv’, ‘wb’) as f:
w = ucsv.writer(f, encoding = ‘gbk’)
w.writerows(data)
2021-10-10
最新推荐文章于 2024-11-04 21:51:40 发布
Python 如何将中文写入csv文件
import unicodecsv as ucsv
data = [[u"列1", u"列2"], [u"内容1", u"内容2"]]
with open(‘test.csv’, ‘wb’) as f:
w = ucsv.writer(f, encoding = ‘gbk’)
w.writerows(data)