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

如何在raw_input() 用中文做提示

  •  
  •   yhdjw · 2011-07-25 20:01:04 +08:00 · 8367 次点击
    这是一个创建于 4665 天前的主题,其中的信息可能已经有所发展或是发生改变。
    python版本 2.7.2
    用utf-8
    raw_input(u'中文')
    #中文变乱码
    提示
    难道raw_input里不能输入中文?
    2 条回复    1970-01-01 08:00:00 +08:00
    c
        1
    c  
       2011-07-25 20:23:03 +08:00
    raw_input(u'中文'.encode('gbk'))

    中文CMD编码默认为GB2312
    yhdjw
        2
    yhdjw  
    OP
       2011-07-25 20:40:43 +08:00
    谢谢大大啊 可以了
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   814 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 22:41 · PVG 06:41 · LAX 15:41 · JFK 18:41
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.