How can I get the logged in users username on Win32?
Mark Hammond
MarkH at ActiveState.com
Fri Mar 2 17:24:14 EST 2001
Fredrik Lundh wrote:
> "nomad" wrote:
>
>> After searching through the Python Docs, I found that on Un*x I could
>> use getpass.getuser(), but there is no equivalent for the Win32
>> platform.
>>
>> In other words, how can I get the username in Windows?
>
>
> getpass.getuser()
>
> (it works as long as USERNAME is set, which it usually is)
And win32api.GetUserName() should work even if it isnt :)
Mark.
More information about the Python-list
mailing list