os.path.getmtime(path)Return the time of last modification of path. The return value is a number giving the number of seconds since the epoch (see thetime module). Raise os.error if the file does not exist or is inaccessible.這是文檔原文,試了一下,返回了一個極大的數(shù),搞不太懂這個函數(shù)什么意思,有什么用呢?
2 回答

慕田峪4524236
TA貢獻1875條經(jīng)驗 獲得超5個贊
這是一個unix時間戳??梢允褂胐atetime庫來處理時間戳:
import datetime, os t = os.path.getmtime( '/' ) tt = datetime.datetime.fromtimestamp(t) ttt = tt.strftime( '%Y' ) # 這是個時間格式化字符串,只能返回年份。 |
添加回答
舉報
0/150
提交
取消