Come posso ottenere la data / ora modificata di un file in Python? [duplicare]

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

  •  02-07-2019
  •  | 
  •  

Domanda

    

Questa domanda ha già una risposta qui:

         

Come posso ottenere la data / ora modificata di un file in Python?

È stato utile?

Soluzione

os.path.getmtime(filepath)

o

os.stat(filepath).st_mtime

Altri suggerimenti

con forma:

import time
print time.strftime("%m/%d/%Y %I:%M:%S %p",time.localtime(os.path.getmtime(fname)))
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top