How to hide password input with getpass in Python 3 on Visual Studio Code?

707 Views Asked by At

The following code snippet:

from getpass import getpass

username = input("Username: ")
password = getpass("Password: ")

When run in Visual Studio Code's integrated Python Console produces the following result:

Username: User
Warning: Password input may be echoed.
Password: hunter2

So whatever I type after the password prompts gets shown. Is there any way to hide this in the integrated VS Code Terminal? In a normal command prompt for example when running

python test.py

I get the following output:

Username: User
Password:

So as expected, whatever I type here after the password prompt does not get displayed.

0

There are 0 best solutions below