2

I'm making a program where the user needs to enter a password. I'm using the input function for this. How would I make it so that the user sees *** symbols instead of the actual letters for their password?

image of code

Jon Clements
  • 138,671
  • 33
  • 247
  • 280

2 Answers2

0

You can use getpass module to hide the password entered on the console.

https://docs.python.org/3.5/library/getpass.html

bboumend
  • 490
  • 3
  • 13
  • Sure, but `getpass` isn't _guaranteed_ to hide the password: "If echo free input is unavailable `getpass()` falls back to printing a warning message to stream and reading from `sys.stdin` and issuing a `GetPassWarning`." – PM 2Ring Dec 28 '17 at 16:28
-1

You can use a function like below

import getpass 
pswd = getpass.getpass('Password:')
clinomaniac
  • 2,200
  • 2
  • 17
  • 22