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
HexHub
HexHub,一站式SSH、Docker、数据库连接管理工具,支持多种主流数据库、多窗口分屏、智能SQL编辑、极速数据处理、批量命令、云端同步,支持SSH跳板机、命令广播、历史命令、SFTP多端文件互传。
Promoted by xiwh
yhdjw
V2EX  ›  Python

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

  •  
  •   yhdjw · 2011-07-25 20:01:04 +08:00 · 8839 次点击
    这是一个创建于 5097 天前的主题,其中的信息可能已经有所发展或是发生改变。
    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   ·   实用小工具   ·   5596 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 06:23 · PVG 14:23 · LAX 23:23 · JFK 02:23
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.