欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

python獲得文件創(chuàng)建時(shí)間和修改時(shí)間的方法

 更新時(shí)間:2015年06月30日 17:10:35   作者:秋風(fēng)秋雨  
這篇文章主要介紹了python獲得文件創(chuàng)建時(shí)間和修改時(shí)間的方法,涉及Python針對(duì)文件屬性的相關(guān)操作技巧,需要的朋友可以參考下

本文實(shí)例講述了python獲得文件創(chuàng)建時(shí)間和修改時(shí)間的方法。分享給大家供大家參考。具體如下:

這里需要用戶從控制臺(tái)輸入文件路徑

import os.path, time
import exceptions
class TypeError (Exception):
  pass
if __name__ == '__main__':
 if (len(os.sys.argv) < 1):
   raise TypeError()
 else:
   print "os.sys.argv[0]: %s" % os.sys.argv[0]
   # os.sys.argv[0] is the current file, in this case, file_ctime.py
 f = os.sys.argv[0]
 mtime = time.ctime(os.path.getmtime(f))
 ctime = time.ctime(os.path.getctime(f))
 print "Last modified : %s, last created time: %s" % (mtime, ctime)

希望本文所述對(duì)大家的Python程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論