I need help to change the letters of the alphabet and numbers (from 0-9) another character like * so that when I type the password people can't look over my shoulder and find out the password. can anyone help?
Asked
Active
Viewed 161 times
2 Answers
4
If your primary concern is simply hiding your password from other people, you should use the built-in getpass.getpass
function:
>>> from getpass import getpass
>>> getpass()
Password:
'abc123'
>>>
As a bonus, getpass
keeps the length of the password concealed (people can easily count the *
's).
4
You can use the getpass
module to hide the password when typed
>>> import getpass
>>> passwd = getpass.getpass("Enter password: ")
Enter password:
>>> print passwd
thisismypassword
>>>

Ashoka Lella
- 6,631
- 1
- 30
- 39