python3 csv 中文乱码【centos系统】

办法一

def writeData(self, movieList):
with open('81.csv', 'w', encoding='utf_8_sig', newline='') as f:
writer = csv.DictWriter(f, fieldnames=['content'])
writer.writeheader()
for each in movieList:
print(each)
writer.writerow(each)

 

办法二
import codecs
csvfile.write(codecs.BOM_UTF8)

上一篇:【TFT-LCD学习记录1】 R61509V3 彩屏显示原理


下一篇:PCAN-USB