UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xe7

  • A+
所属分类:python 技巧

UnicodeDecodeError: 'ascii' codec can't decode byte 0xe7

问题描述:

python进行字符串操作时,出现以下报错:

UnicodeDecodeError: 'ascii' codec can't decode byte 0xe7 in position 0: ordinal not in range(128)

解决方案:

import sys
reload(sys)
sys.setdefaultencoding('utf8')
百分购

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: