getpass
On all versions of Python 3, we can use the getpass
module from the built-in Python Standard Library to prompt the user to enter a password.
The user's password will not show up on-screen while the user is typing it.
1 2 3 | from getpass import getpass password = getpass( 'Password: ' ) |
We can replace 'Password: '
in the code above with any message that we want to show before the password input cursor.