File Attributes conversion
Sam Collett
sam_collett at lycos.co.uk
Mon Mar 4 07:31:54 EST 2002
I can get file attributes using os.path.getsize and os.path.getmtime
etc, but I am not sure how to convert them into something more
understandable
e.g.
File Size to display in bytes (if < 3kb), kilobytes (if < 2MB) and
megabytes (> 2MB). How would you do that (the value I get is 12345L -
what is the L?)
Modified/Created time to be displayed as GMT (DD mm YYYY, HH MM am/pm)
14/09/2002, 5:54pm (is it in seconds currently [starting from which
year]?)
I am doing this on Windows 98SE, is it possible to get the code to
work cross platform as well?
TIA
PS Can you also get other attributes (read-only, hidden, compressed,
system, archive, etc)?
More information about the Python-list
mailing list