1
#! /usr/bin/env python
#filename:pwd.py
# development environment:python2.51


import getpass
usr=getpass.getuser()


while True:
    pwd=getpass.getpass("passwd:%s:" % usr)
    if pwd=='123':
        print "welcome to python!!!!"
        break
    else:
        print "The password you entered is incorrect"
2
Contributors
2
Replies
4
Views
7 Years
Discussion Span
Last Post by vansoking
0

I'm not sure it work on mac
getpass.getuser() Return the “login name” of the user. Availability: Unix, Windows.

Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.