getting username from uid

Mark McEahern marklists at
Mon Sep 16 10:34:14 EDT 2002

>   when I do a stat on a file I can get the UID of the owner. IS there
> anyway to get from UID to username (or directly to username for that
> matter)?

import pwd
user = pwd.getpwuid(uid)
# user is a tuple
print user[0]

// m

More information about the Python-list mailing list