OS specific command in Python
Avell Diroll
avelldiroll at yahoo.fr
Wed Jun 21 01:44:58 EDT 2006
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