Implementing some of 'ls -l" directly in python
Ian Bicking
ianb at colorstudy.com
Tue Nov 19 19:03:24 EST 2002
On Tue, 2002-11-19 at 17:50, Tim Daneliuk wrote:
> So, I use os.path.getmtime and os.path.getsize for two of the things I
> need. I then stat the file to get its UID, GID, and permission bits.
> Here's where I get stuck. I cannot seem to find a portable way to
> convert the UID/GID into their equivalent string names. Also, it would
> be handy if there were a (portable) way to convert the permission value
> into the more familiar u/g/o - drwx format.
There's the pwd and grp modules, which might give a start.
Ian
More information about the Python-list
mailing list