Sending mail from 'current user' in Python

Grig Gheorghiu grig.gheorghiu at gmail.com
Sat Jun 11 05:52:51 CEST 2005


I use this function as a platform-independent way of finding out the
current user name:

def get_username():
    if sys.platform == 'win32':
        return win32api.GetUserName()
    else:
        return getpass.getuser()




More information about the Python-list mailing list