results of stat[ST_ATIME]???????

Gerhard Häring gh_pythonlist at gmx.de
Wed Jun 19 00:20:11 CEST 2002


* jubafre at zipmail.com.br <jubafre at zipmail.com.br> [2002-06-18 18:58 -0300]:
> when i use st[ST_ATIME] a int number is returned, how i can transform
> this number to a "time number"???????

time.gmtime and time.localtime, depending on wether you want GMT or time
in the local timezone. Check out the docs for the time module for
details. If you want to have a readable string instead of the tuple
gmtime/localtime give you, you need to format using strftime.

Example:

time.strftime("%Y-%m-%d %H:%M:%S",
    time.localtime(os.stat("/tmp/a")[stat.ST_ATIME]))

Gerhard
-- 
This sig powered by Python!
Außentemperatur in München: 25.0 °C      Wind: 1.1 m/s





More information about the Python-list mailing list