Вопрос

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?

Это было полезно?

Решение

Use the built-in getpass module:

>>> import getpass
>>> x = getpass.getpass("enter password: ")
enter password:
>>> print(x)
'test'
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top