WinNT User Name

Ralf Claus ralf.claus at teleatlas.com
Wed Jul 5 01:07:13 EDT 2000


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

..and finally

import getpass
username = getpass.getuser()

works on both systems (NT,UNIX), if you need.



More information about the Python-list mailing list