def set_file_mtime ( path , mtime , atime = None ) : if not atime : atime = mtime f = open ( path , 'a' ) try : os . utime ( path , ( atime , mtime ) ) finally : f . close ( )
python set access time of file
Set access and modification times on a file .
def set_file_mtime(path, mtime, atime=None):
  """Set access and modification times on a file."""
  if not atime:
    atime = mtime
  f = open(path, 'a')
  try:
    os.utime(path, (atime, mtime))
  finally:
    f.close()