If you only want the modified time, then os.path.getmtime(filename)
will get it for you. If you are using listdir
with an argument, you'll need to also use os.path.join
:
import os, os.path
for filename in os.listdir(SOME_DIR):
print os.path.getmtime(os.path.join(SOME_DIR, filename))