"UnicodeDecodeError: ‘ascii‘ codec can‘t decode byte 0xe9 in position 0: ordinal not in range(128)"
解决办法,在该python文件的前面加上如下几句,问题得到解决
#!/usr/bin/env python
# -*- coding:utf8 -*-
import sys
default_encoding = ‘utf-8‘
if sys.getdefaultencoding() != default_encoding:
reload(sys)
sys.setdefaultencoding(default_encoding)
python 处理中文时出现的错误'ascii' codec can't decode byte 0xe9 in position 0: ordinal not in range(128)" 解决方法
时间: 2024-10-26 09:33:06