2008-09-23 5 views

Répondre

38
os.path.getmtime(filepath) 

ou

os.stat(filepath).st_mtime 
+0

ce qui est mieux? :) – endolith

+1

@endolith: http://stackoverflow.com/a/237082/125507 dit "os.path.getmtime() est fait pour cela, et plus simple." – endolith

19

formated:

import time 
print time.strftime("%m/%d/%Y %I:%M:%S %p",time.localtime(os.path.getmtime(fname))) 
+0

Merci d'avoir posté ce message! –

Questions connexes