0

i am trying to make a sign up and login systen and i would like the user to see '***********' when they enter their password instead of 'Password123', for example.

with open("UandP.txt", "a") as x:
    x.write(input("Enter a username: "))
    x.write(",")
    x.write(input("Enter a password: ") + "\n")

i would like the input from 'input("Enter a password: ")' to echo in the shell as '*' but i cant use getpass() as it doesn't work in the shell

Ethan2001
  • 51
  • 4
  • I have no issues with `pwd = getpass.getpass()` working in the shell. Check out https://stackoverflow.com/questions/34396842/getpass-input-python-3 for more information about echoing. That might point you in the right direction. I would not recommend masking the input; you technically expose the password length by doing so. – artomason Oct 05 '18 at 16:02
  • As artomason's link says, the behaviour of `getpass` depends on the terminal it's running in. Which terminal are you using? But anyway, at best, `getpass` can only blank passwords, it doesn't do asterisks. – PM 2Ring Oct 05 '18 at 16:04
  • There are some suggestions here: https://stackoverflow.com/questions/27631629/masking-user-input-in-python-with-asterisks But they might not work on your terminal. – PM 2Ring Oct 05 '18 at 16:20

0 Answers0