Comment obtenir la date / heure modifiée d'un fichier en Python? [dupliquer]

StackOverflow https://stackoverflow.com/questions/121025

  •  02-07-2019
  •  | 
  •  

Question

    

Cette question a déjà une réponse ici:

         

Comment obtenir la date / heure modifiée d'un fichier en Python?

Était-ce utile?

La solution

os.path.getmtime(filepath)

ou

os.stat(filepath).st_mtime

Autres conseils

Formated:

import time
print time.strftime("%m/%d/%Y %I:%M:%S %p",time.localtime(os.path.getmtime(fname)))
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top