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

(四在农家•美丽乡村),这个点应该怎么处理

  •  
  •   omg21 · Mar 15, 2017 · 2841 views
    This topic created in 3343 days ago, the information mentioned may be changed or developed.

    在网上抓取的新闻,有时候会遇到这样的点,文字编码已经转换过了,但还是会报错 'gbk' codec can't encode character '\u2022' in position 20

    不知道该如何处理这个点。系统 是 python3.4+sublime

    4 replies    2017-03-16 12:33:50 +08:00
    bxb100
        1
    bxb100  
       Mar 15, 2017 via Android
    转成 UTF-8 应该能解决啊
    PythonAnswer
        2
    PythonAnswer  
       Mar 16, 2017 via Android
    不 print 出来 是没事的。你的 windows stdout 不是 utf8 。
    nyanyh
        3
    nyanyh  
       Mar 16, 2017
    执行 py 脚本前先在 cmd 执行一下 chcp 65001
    backing
        4
    backing  
       Mar 16, 2017
    可能这个字符 gbk 没有收录,可以考虑用 GB18030
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3325 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 55ms · UTC 12:47 · PVG 20:47 · LAX 05:47 · JFK 08:47
    ♥ Do have faith in what you're doing.