getting user id (from an arbitrary sys user)

Tina I tinaweb at bestemselv.com
Thu Mar 15 07:48:24 CET 2007


Gerardo Herzig wrote:
> hi all. What i need to know is if there is some function like 
> os.getuid(), but taking an argument (the username, off course), so i can 
> do getuid('myuser')
> 
> Thanks you dudes!
> 
> Gerardo
How about simply:

import commands
userid = commands.getoutput("id -u username")




More information about the Python-list mailing list