首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >UnicodeDecodeError,无效的继续字节

UnicodeDecodeError,无效的继续字节
EN

Stack Overflow用户
提问于 2011-04-05 21:23:41
回答 8查看 971.6K关注 0票数 365

为什么下面的项目失败了?为什么使用“拉丁语-1”编解码器会成功?

代码语言:javascript
复制
o = "a test of \xe9 char" #I want this to remain a string as this is what I am receiving
v = o.decode("utf-8")

这会导致:

代码语言:javascript
复制
 Traceback (most recent call last):  
 File "<stdin>", line 1, in <module>  
 File "C:\Python27\lib\encodings\utf_8.py",
 line 16, in decode
     return codecs.utf_8_decode(input, errors, True) UnicodeDecodeError:
 'utf8' codec can't decode byte 0xe9 in position 10: invalid continuation byte
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5552555

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档