To use codecs, we can write UTF-8 characters into csv file
import codecswith open('ExcelUtf8.csv', 'w') as f: t = u'晚上吃什么' f.write(codecs.BOM_UTF8) f.write('%s,1,3\n' % t.encode('utf-8'))
本文共 252 字,大约阅读时间需要 1 分钟。
To use codecs, we can write UTF-8 characters into csv file
import codecswith open('ExcelUtf8.csv', 'w') as f: t = u'晚上吃什么' f.write(codecs.BOM_UTF8) f.write('%s,1,3\n' % t.encode('utf-8'))
转载于:https://www.cnblogs.com/wushuaiyi/p/6743437.html