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

python2.7中怎样实现用户输入密码用*显示

  •  
  •   xiangpeng · 2012-02-06 18:57:30 +08:00 · 7063 次点击
    这是一个创建于 4434 天前的主题,其中的信息可能已经有所发展或是发生改变。
    RT 新手请教,看了下有个模块是getpass,没太看懂,有没有什么别的,请指教。
    6 条回复    1970-01-01 08:00:00 +08:00
    fanzeyi
        1
    fanzeyi  
       2012-02-06 19:00:28 +08:00
    getpass很难懂么

    import getpass

    pass = getpass.getpass('Password:')
    013231
        2
    013231  
       2012-02-06 19:00:40 +08:00
    getpass输入密码是不回显的. unix风格的输入密码就是不回显的, 为何要显示*呢?
    loading
        3
    loading  
       2012-02-06 19:04:45 +08:00
    getpass为什么不能可选回显*呢?(我没看文档,可能有误,望指正)
    phus
        4
    phus  
       2012-02-06 19:21:30 +08:00
    xiangpeng
        5
    xiangpeng  
    OP
       2012-02-06 20:29:35 +08:00
    @fanzeyi 不是我看不懂,但是我在win下的python2.7中提示警告,怎么办?
    xiangpeng
        6
    xiangpeng  
    OP
       2012-02-06 20:45:49 +08:00
    好了 明白了 谢了各位。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3146 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 12:36 · PVG 20:36 · LAX 05:36 · JFK 08:36
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.