Sending mail from 'current user' in Python

Grig Gheorghiu grig.gheorghiu at gmail.com
Fri Jun 10 23:52:51 EDT 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