Get The Created Or Modified Timestamp For A File In Python

February 2023

TODO: Add note about creating and modified times and how they intermix.


import os

file_path = "/Users/alan/Desktop/example.txt"

modified_time = os.path.getmtime(file_path)

print(modified_time)
Output:
1676929897.4714947
end of line