我想使用:
import getpass
password = getpass.getpass("Enter your password:")
print password
在winx64上使用Python 2.7时... 第二行代码卡住了。 我看不到弹出窗口:“输入您的密码:”
我想使用:
import getpass
password = getpass.getpass("Enter your password:")
print password
在winx64上使用Python 2.7时... 第二行代码卡住了。 我看不到弹出窗口:“输入您的密码:”
def spyder_getpass(prompt='Password: '):
set_spyder_echo(False)
password = raw_input(prompt)
set_spyder_echo(True)
return password
尝试使用上述方法(使用 raw_input 而不是 getpass)获取所需的密码。
userpassword = spyder_getpass()
等等。不要调用自己的input
或与getpass
有关的任何内容。 - PenguinCoderset_spyder_echo
函数。 - Air正如其他评论所指出的那样,您必须在Power Shell中运行此脚本,才能看到"输入您的密码:"
文本并能够输入密码。