Returns the day the given path was last modified. A os.error
occurs if the file does not exist or is inaccessible.
import os.path, time
print "last modified: %s" % time.ctime(os.path.getmtime(file))
print "created: %s" % time.ctime(os.path.getctime(file))
Returns an object that contains the following information about the file:
import os
fileinfo = os.stat(path)
print fileinfo.st_mtime
import os, time
(mode, ino, dev, nlink, uid, gid, size, atime, mtime, ctime) = os.stat(file)
print "last modified: %s" % time.ctime(time)
However, in Linux/unix systems, ctime() means the time when inode data
has changed, not the creation date.
© 2024 OneMinuteCode. All rights reserved.