解决 Python 2.x 下 UnicodeEncodeError
· One min read
报错
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1: ordinal not in range
在 py 文件最上面添加:
import sys
reload(sys)
sys.setdefaultencoding('utf8')
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1: ordinal not in range
在 py 文件最上面添加:
import sys
reload(sys)
sys.setdefaultencoding('utf8')