[错误解决]UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-3: ordinal not in range(128)

python2内容无法写入csv,报错:UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-3: ordinal not in range(128)

因为要跟2的代码对接,代码需要写入表格,但是一直写入不进去,一直报错:
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-3: ordinal not in range(128)

查看*发现安装unicodecsv可以解决
安装:pip2 install unicodecsv
使用:
把 import csv
改成 import unicodecsv as csv in your code

上一篇:解决UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1: ordinal not in range


下一篇:WhatsApp值160亿美元,腾讯推大众点评微信支付!