Python: how to conceal input
Question:
How do you conceal the input of raw_input
? For example, I want:
password = raw_input("Password: ")
To be
Password: ********
#or
Password: #hide the characters (i.e. no echo)
Instead of displaying the string. How can I do so?
Answers:
Use getpass
:
import getpass
password = getpass.getpass('Password: ')
How do you conceal the input of raw_input
? For example, I want:
password = raw_input("Password: ")
To be
Password: ********
#or
Password: #hide the characters (i.e. no echo)
Instead of displaying the string. How can I do so?
Use getpass
:
import getpass
password = getpass.getpass('Password: ')