Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

How to hide user input for password in Python

Question: How do I Hide user input for a Password entry using Python?   So instead of  the password displaying as the user types the password , the screen wouldn't change.

Answer: There is the getpass() function , which comes as standard part of the Python Library . From the Python documentation:  "Prompt the user for a password without echoing. The user is prompted using the string prompt, which defaults to 'Password: '"

import getpass

password = getpass.getpass()
print(password)



This post first appeared on Dba-ninja.com, please read the originial post: here

Share the post

How to hide user input for password in Python

×

Subscribe to Dba-ninja.com

Get updates delivered right to your inbox!

Thank you for your subscription

×