Posted By

manatlan on 09/09/09


Tagged

file python DateTime


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

gartenstuhl


file time datetime


 / Published in: Python
 

  1. # recupete le mtime d'un fichier
  2. import os
  3. file="c:\gce.png"
  4. mtime = os.stat(file).st_mtime
  5.  
  6. # le transforme en time
  7. import time
  8. print time.localtime(mtime)
  9.  
  10. # le transforme en datetime
  11. import datetime
  12. print datetime.datetime.fromtimestamp(mtime)

Report this snippet  

You need to login to post a comment.