Question

This question already has an answer here:

How do I get the modified date/time of a file in Python?

Was it helpful?

Solution

os.path.getmtime(filepath)

or

os.stat(filepath).st_mtime

OTHER TIPS

Formated:

import time
print time.strftime("%m/%d/%Y %I:%M:%S %p",time.localtime(os.path.getmtime(fname)))
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top