getpass
getpass — Portable password input
Source code: Lib/getpass.py
The getpass
module provides two functions:
-
getpass.getpass(prompt='Password: ', stream=None)
-
Prompt the user for a password without echoing. The user is prompted using the string prompt, which defaults to
'Password: '
. On Unix, the prompt is written to the file-like object stream using the replace error handler if needed. stream defaults to the controlling terminal (/dev/tty
) or if that is unavailable tosys.stderr登录查看完整内容