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

Guilherme Polo ggpolo at gmail.com
Wed Jul 23 11:44:24 EDT 2008


On Wed, Jul 23, 2008 at 9:16 AM, Sebastian lunar Wiesner
<basti.wiesner at gmx.net> wrote:
> 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
>

That is valid since Python 2.3 actually

> Slightly more readable, imho
>
>
>
> --
> Freedom is always the freedom of dissenters.
>                                      (Rosa Luxemburg)
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
-- Guilherme H. Polo Goncalves



More information about the Python-list mailing list