V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
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 · May 15, 2017 · 2686 views
    This topic created in 3274 days ago, the information mentioned may be changed or developed.
    我在 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 replies    2017-05-17 20:50:47 +08:00
    binux
        1
    binux  
       May 15, 2017
    你 API 调错了
    stamaimer
        2
    stamaimer  
       May 17, 2017
    在 encode 的时候出了 UnicodeDecodeError 的错,你要搞清楚 encode,decode,unicode(str), str(bytes)的关系。括号里是 python3 的类型。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   989 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 18:09 · PVG 02:09 · LAX 11:09 · JFK 14:09
    ♥ Do have faith in what you're doing.