Skip to content

Instantly share code, notes, and snippets.

@baybatu
Created June 25, 2012 17:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baybatu/2990129 to your computer and use it in GitHub Desktop.
Save baybatu/2990129 to your computer and use it in GitHub Desktop.
Python'da dosyanın son değiştirme zamanını almak
import os
(mode, ino, dev, nlink, uid, gid, size, atime, mtime, ctime) = os.stat("dosya.py")
# bu çok tercih edilmez. bir de daha karışık
####### ya da #########
a = os.path.getmtime("foo.py")
print type(a) # float
# 1340619312.918 gibi bir float sayı verir. Bunu okunabilir hale getirmek için time modülündeki ctime metodu kullanılabilir.
import time
print time.ctime(os.path.getmtime("foo.py")) # 'Mon Jun 25 13:15:12 2012'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment