python vs awk for simple sysamin tasks

David M. Cooke cookedm+news at physics.mcmaster.ca
Thu Jun 3 23:11:31 EDT 2004


At some point, Steve Lamb <grey at despair.dmiyu.org> wrote:

> On 2004-06-03, Matthew Thorley <ruach at chpc.utah.edu> wrote:
>> Another question. The example my friend gave me takes the user name as 
>> an argument not the uid. Does any one know how to convert usernames to 
>> uids and vice versa in python ?  Please also comment on the script, any 
>> thoughts on simplification ?
>
>     I'd just do a quick pass over the passwd file ...

That won't work (for all uids) if a network-based database (like NIS)
is used. You want the pwd module.

-- 
|>|\/|<
/--------------------------------------------------------------------------\
|David M. Cooke
|cookedm(at)physics(dot)mcmaster(dot)ca



More information about the Python-list mailing list