how to find current working user

Chris Mellon arkanes at gmail.com
Mon Feb 11 14:27:15 EST 2008


On Feb 11, 2008 12:30 PM, Gabriel Genellina <gagsl-py2 at yahoo.com.ar> wrote:
> En Mon, 11 Feb 2008 15:21:16 -0200, Praveena Boppudi (c)
> <pboppudi at vmware.com> escribi�:
>
> > Can anyone tell me how to find current working user in windows?
>
> If it is just informational, use os.environ['USERNAME']
> Using win32wnet (from the pywin32 package):
>
> py> import win32wnet
> py> win32wnet.WNetGetUser()
> 'gabriel'
>


Using stdlib only:
import getpass;getpass.getuser()


More information about the Python-list mailing list