def getpass(self, prompt='Password : ', stream=None):
"""Prompt for password with echo off, using Unix getch()."""
password = ""
sys.stdout.write(prompt)
while True:
c = _win_getch() if os.name == 'nt' else self._unix_getch()
if c == '\r' or c == '\n':
break
if c == '\003':
raise KeyboardInterrupt
if c == '\b':
c = ''
password += c
sys.stdout.write("*")
return password
评论列表
文章目录