Getting Password from User
David Goodger
dgoodger at bigfoot.com
Sun Jun 18 16:42:34 EDT 2000
on 2000-06-18 15:49, Tom Santos (tomsantos at email.com) wrote:
> I'm trying to get a username and password from a user so that I can create
> an FTP connection. I'm using raw_input() to get the username but it's not
> acceptable to get their password. If I use raw_input() to get the password,
> the user's password is echoed to the screen. Is there any way to make it so
> that their password is not shown entirely, or characters like '*' are
> displayed instead of the characters in their password?
Use module getpass:
import getpass
password = getpass.getpass()
If you still see the password echoed to the screen, then you're missing some
functionality, probably termios. Check out the getpass.py code for the
decision tree that is followed.
--
David Goodger dgoodger at bigfoot.com Open-source projects:
- The Go Tools Project: http://gotools.sourceforge.net
(more to come! real soon now!)
More information about the Python-list
mailing list