Proper way to query user and group database on a Unix host?

Sebastian "lunar" Wiesner basti.wiesner at gmx.net
Wed Jul 23 08:16:03 EDT 2008


Chris Brannon <cmbrannon at cox.net>:

Iirc since Python 2.5 these tuples are named ...

> Instead, do this:
> 
> import grp
> groupname = 'users'
> groupusers = grp.getgrnam(groupname)[3]
... thus this line could be written as:

groupusers = grp.getgrnam(groupname).gr_mem

Slightly more readable, imho



-- 
Freedom is always the freedom of dissenters.
                                      (Rosa Luxemburg)



More information about the Python-list mailing list