WinNT User Name

j vickroy jvickroy at sec.noaa.gov
Mon Jul 3 15:00:59 EDT 2000


On Windows NT:

import os
os.environ['USERNAME']

... provides the information.

I do not believe that either Win 95 or 98 has the 'USERNAME' attribute set.

michael montagne wrote:

> First off, I'm a newbie at Python.
> I'm trying to return the user who is logged on at a PC.  What I really need
> is the login name.  How do I do that?  Seems like it otta be quite simple
> but I'm having trouble.
>
> -mjm




More information about the Python-list mailing list