UnicodeEncodeError: 'ascii' codec can't encode characters in position
程序员文章站
2023-03-26 13:19:31
UnicodeEncodeError: 'ascii' codec can't encode characters in position python运行时出现这个错误,解决方法如下: 加入如下语句: ......
unicodeencodeerror: 'ascii' codec can't encode characters in position
python运行时出现这个错误,解决方法如下:
加入如下语句:
import sys
reload(sys)
sys.setdefaultencoding( "utf-8" )
推荐阅读
-
python中time.strftime不支持中文,报错UnicodeEncodeError: 'locale' codec can't encode character '\u5e74' in position 2: encoding error
-
UnicodeEncodeError: 'ascii' codec can't encode characters in position
-
UnicodeDecodeError: ‘ascii‘ codec can‘t decode byte 0xcb in position 260: ordinal not in range(128)
-
Python2.7更新pip:UnicodeDecodeError: 'ascii' codec can't decode byte 0xb7 in position 7: ordinal not in range(128)
-
Python “'ascii' codec can't decode byte 0xb0i in position 1” 的解决方法
-
UnicodeEncodeError: 'gbk' codec can't encode character '\xe7' in position 10 解决乱码问题
-
python 运行 execjs 出现错误 UnicodeEncodeError: ‘gbk‘ codec can‘t encode character ‘\ufffd‘
-
【python】pip安装报错UnicodeDecodeError: 'ascii' codec can't decode byte 0xce in position 7: ordinal not i
-
[解决]SyntaxError: ‘ascii‘ codec can‘t decode byte 0xe6 in position 4: ordinal not in range (128)
-
解决Python3控制台输出的UnicodeEncodeError: ‘gbk‘ codec can‘t encode character ‘\u30fb‘ in position 0:问题