Is there a way in Python to convert characters as they are being entered by the user to asterisks, like it can be seen on many websites?
For example, if an user sets his password as " pass@123" then while entering it should be like
Password : ********
I installed pwinput module but I'm unable to import it. While importing it is showing
import pwinput
"pwinput" is not accessed Pylance
Import "pwinput" could not be resolved Pylance (reportMissingImports)
This is the code where I'm prompting password from the user :
def registration():
Fname = input("Enter first name: ")
Lname = input("Enter last name: ")
while(True):
gender = input("Enter your gender: ")
if(gender not in "MmFf"):
print("THE GENDER YOU HAVE ENTERED IS INCORRECT TRY AGAIN ")
else:
break
age = int(input("Enter your age: "))
phoneno = int(input("Enter your phone number: "))
city = input("Enter your city: ")
email = input("Enter your email id: ")
while True:
passwd = input("Enter your password: ")
repasswd = input("Re-enter your password: ")
if passwd!=repasswd:
print("Password doesn't match. Try again!")
else:
break
Q = "insert into registration values ('"+Fname +"','"+Lname+"','"+gender+"',"+str(phoneno)+","+str(age)+",'"+email+"','"+passwd+"','"+city+"');"
mycursor.execute(Q)
mydb.commit()
print("Registration done successfully!")
What am I missing here? And what is the correct solution for it?