hiding command line input

Paul Rubin phr-n2002b at NOSPAMnightsong.com
Sat Jul 13 00:29:53 EDT 2002


destr0 <replyonnewsgroup at doit.com> writes:
> I'm in the habit of using raw_input() for user interaction on
> the command line.  I now have a situation where I need to
> prompt the user for input on the command line, but I need
> to get a password from them, so I'd like to hide the display
> of the letters on the screen.  Is there another python function
> that will get input in the manner raw_input() does, but mask the
> input from the user, or am I going to have to roll my own
> function.

Use the getpass module:

   import getpass
   password = getpass.getpass("Enter password: ")



More information about the Python-list mailing list