标签:sci lte utf8 默认 import har encoding 编码 python
python默认的编码是ascii,当程序中出现非ascii编码时,python的处理常常会报这样的错,python没办法处理非ascii编码的,
此时需要自己设置python的默认编码,一般设置为utf8的编码格式。
cat myutf8.py #添加如下内容,设置编码为utf8
# encoding=utf8
import sys
reload(sys)
sys.setdefaultencoding(‘utf8‘)
python:'ascii' codec can't encode character
标签:sci lte utf8 默认 import har encoding 编码 python
原文地址:http://www.cnblogs.com/hixiaowei/p/7835399.html