OS specific command in Python

diffuser78 at gmail.com diffuser78 at gmail.com
Wed Jun 21 15:34:42 CEST 2006


I have a question on getpass. Since I am a newbie you might find it a
little dumb.

By using the getpass, are u trying to retrieve the username and
password of remote mahcine or local ?



Avell Diroll wrote:
> stephanearnold at yahoo.fr wrote:
> > When you connect (via ssh or telnet) to a remote machine, you need to
> > type (manually)
> > your username and your password. Programming that is never easy.
> >
>
> This is really eased by the module getpass (std library) :
>
> ###
>
> import getpass
>
> login = getpass.getuser()
> password = getpass.getpass()
>
> ###
>
> If the username is different from your system login this can be changed to :
>
> ###
>
> import getpass
>
> login = raw_input('login: ')
> password = getpass.getpass()
> 
> ###
> 
> 
> Python definitely comes with batteries included !




More information about the Python-list mailing list