File date attribute

Fredrik Lundh fredrik at
Sat Jan 28 08:55:18 EST 2006

Bruce R Graham wrote:

> I have most of the pieces in place, except I can't find out how to
> retrieve the date modified attribute of a file. Does anybody know how
> to do that?

t = os.path.getmtime(filename)

returns the timestamp as seconds since the epoch.  see the "time" and
"datetime" modules for ways to convert this to other formats (if needed).


More information about the Python-list mailing list