Write a Python program that retrieves the date and time of file creation and modification.

Write a Python program that retrieves the date and time of file creation and modification.

1
2
3
import os.path, time
print("Last modified: %s" % time.ctime(os.path.getmtime("test.txt")))
print("Created: %s" % time.ctime(os.path.getctime("test.txt")))

Final output

Leave a Comment