How do I convert a password into asterisks while it is being entered? [duplicate]

There is getpass(), a function which hides the user input.

import getpass

password = getpass.getpass()
print(password)

Leave a Comment