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

Sebastian "lunar" Wiesner basti.wiesner at gmx.net
Wed Jul 23 11:59:53 EDT 2008


Guilherme Polo <ggpolo at gmail.com>:

> 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

Thanks for clarification


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



More information about the Python-list mailing list