How to get file creation and modification date and times in Python

1 Answer

0 votes
import os
import time

print("file last modified: %s" % time.ctime(os.path.getmtime("d:\data.txt")))
print("file created: %s" % time.ctime(os.path.getctime("d:\data.txt")))

'''
run:

file last modified: Tue Jun 23 19:42:35 2015
file created: Tue Mar 17 07:47:39 2015

'''

 



answered Jun 23, 2015 by avibootz

Related questions

1 answer 133 views
1 answer 116 views
116 views asked Aug 14, 2023 by avibootz
1 answer 197 views
1 answer 184 views
184 views asked Jun 17, 2016 by avibootz
...