Python: display input as "*"

I'm not very familiar with Python at all and I am trying to accomplish some basic tasks.
I want the user to enter text, but I want it to appear as "*". I am not sure how to do this and have not found a solution.

x = input("Input to appear normally: ")
y = input("I want this to appear as ******: ")

      

I have no idea what is ever about how to do this.
I will be very grateful for your help. Thank!

+3


source to share


1 answer


You can use:

import getpass

pswd = getpass.getpass('Password:')

      



And if you want to display input as "*" this answer explains how to do that.

+5


source







All Articles