相关疑难解决方法(0)

Python - 'ascii'编解码器无法解码字节

我真的很困惑.我试着编码,但错误说can't decode....

>>> "??".encode("utf8")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe4 in position 0: ordinal not in range(128)
Run Code Online (Sandbox Code Playgroud)

我知道如何避免字符串上带有"u"前缀的错误.我只是想知道为什么在调用编码时错误是"无法解码".什么是Python在幕后做什么?

python unicode python-2.x python-2.7 python-unicode

113
推荐指数
4
解决办法
28万
查看次数

标签 统计

python ×1

python-2.7 ×1

python-2.x ×1

python-unicode ×1

unicode ×1