推荐学习书目
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
shyrock
V2EX  ›  Python

import 一个网页检查模块的时候报错:SyntaxError: 'gbk' codec can't decode bytes in position 28-29: illegal multibyte sequence。

  •  
  •   shyrock · May 22, 2014 · 7685 views
    This topic created in 4400 days ago, the information mentioned may be changed or developed.
    被引入模块和主模块都是cp936编码的,换成utf-8也不行,有大大知道怎么解决吗?
    2 replies    2014-05-22 15:29:07 +08:00
    shyrock
        1
    shyrock  
    OP
       May 22, 2014
    补充:网页检查代码中有中文。如果换成utf-8,报错:UnicodeDecodeError: 'ascii' codec can't decode byte 0xe7 in position 0: ordinal not in range(128)
    shyrock
        2
    shyrock  
    OP
       May 22, 2014
    问题关闭,是我愚蠢的忘了在字符串前加u。。。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   945 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 20:07 · PVG 04:07 · LAX 13:07 · JFK 16:07
    ♥ Do have faith in what you're doing.