今天在验证字符串是否包含的时候报错:UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 12: ordinal not in range(128)
原因是python的str默认是ascii编码,和unicode编码冲突,就会报这个错误。
解决办法:

import sys
reload(sys)
sys.setdefaultencoding('utf8')

相关文章:

  • 2021-12-05
  • 2022-12-23
  • 2021-05-10
  • 2021-06-06
  • 2021-07-24
  • 2021-08-01
  • 2021-07-24
  • 2022-01-05
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-06-29
  • 2022-01-05
  • 2021-09-02
相关资源
相似解决方案