I'm creating a program that will require the user to enter a password. Is there a code that I can add in my program that way if someone is sitting behind the user or looking over his/her shoulder they don't see the password on the screen?
Asked
Active
Viewed 250 times
1 Answers
5
Use the built-in getpass
module:
>>> import getpass
>>> x = getpass.getpass("enter password: ")
enter password:
>>> print(x)
'test'

Nigel Tufnel
- 11,146
- 4
- 35
- 31
-
can I get that encrypted?? – py_newbie Jan 28 '14 at 23:37
-
http://stackoverflow.com/a/16334504/1240162 – Nigel Tufnel Jan 28 '14 at 23:46