V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
oyosc
V2EX  ›  Python

想问下大家关于一个编码的问题,感觉比较偏

  •  
  •   oyosc · 2017-05-15 23:19:49 +08:00 · 2129 次点击
    这是一个创建于 2554 天前的主题,其中的信息可能已经有所发展或是发生改变。
    我在 linux 下用 iconv 将 gbk 转成了 utf-8 的 text 文本,但是 python 在 encode 的时候报出了 UnicodeDecodeError: 'ascii' codec can't decode byte 0xb7 in position 63: ord,问了下别人说这是因为会产生 u"x"的符号,想问下这个是什么符号呀,啥意思,我 cat -A 也查不到
    2 条回复    2017-05-17 20:50:47 +08:00
    binux
        1
    binux  
       2017-05-15 23:35:48 +08:00
    你 API 调错了
    stamaimer
        2
    stamaimer  
       2017-05-17 20:50:47 +08:00
    在 encode 的时候出了 UnicodeDecodeError 的错,你要搞清楚 encode,decode,unicode(str), str(bytes)的关系。括号里是 python3 的类型。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1856 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 16:31 · PVG 00:31 · LAX 09:31 · JFK 12:31
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.