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
invite
V2EX  ›  Python

Python 编码疑问?

  •  
  •   invite · Jan 19, 2015 · 2618 views
    This topic created in 4117 days ago, the information mentioned may be changed or developed.
    情况是这样的:
    1. 用urllib2获取一个web页面, 页面是UTF-8的编码.
    2. 用BeautifulSoup解析

    结果报错: 'gbk' codec can't encode character....

    这个 gbk 是什么时候出现的?

    环境: Windows XP / Python 2.7
    2 replies    2015-01-19 20:50:07 +08:00
    aeshfawre
        1
    aeshfawre  
       Jan 19, 2015
    显示的窗口是gbk的, 你不显示到窗口上,就应该不抱错了
    invite
        2
    invite  
    OP
       Jan 19, 2015
    @aeshfawre 原来这样,多谢。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1144 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 18:12 · PVG 02:12 · LAX 11:12 · JFK 14:12
    ♥ Do have faith in what you're doing.