python vs awk for simple sysamin tasks

David M. Cooke cookedm+news at
Fri Jun 4 05:11:31 CEST 2004

At some point, Steve Lamb <grey at> wrote:

> On 2004-06-03, Matthew Thorley <ruach at> 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

More information about the Python-list mailing list