Get the time of last modification :
import os result = os.path.getmtime(path)
The function returns a value which is the number of seconds since the epoch.
Get the time of file creation :
result = os.path.getctime(path)
The function returns a value which is the system’s ctime which, on Unix and Linux systems is the time of the last metadata change. While on Windows it is the creation time. The return value is the number of seconds since the epoch.
Both functions raise OSError if the file does not exist or is inaccessible.
Both have been changed in version 3.6 to accepts a path-like object.
Minimum Requirements and How-to: