Skip to main content
 首页 » 编程设计

Python,在shell中隐藏密码

2025年05月04日16JustinYoung

<分区>

有没有办法在 python shell 中隐藏密码?,比如显示点。这是用于在 python 程序中登录的输入。 getpass 显示:

Warning (from warnings module): 
 File "C:\Python34\lib\getpass.py", line 101    
    return fallback_getpass(prompt, stream)    
GetPassWarning: Can not control echo on the terminal. 
Warning: Password input may be echoed. Enter your password: hammad 
hammad 

密码是可见的,我有自己的 python 脚本来获取用户名和密码,使用数据库检查帐户是否存在。