主要邏輯是判斷文件的最後修改時間與建立時間是否在秒級別上一致,此代碼適用於Python 2.x;Python 3.x須要改一下代碼。
import time
import oside
#Read fime name
FileName='D:/scapegoat/xx.csv'it
#print file creation time
print time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(os.stat(FileName).st_ctime))io
#print file modified time
print time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(os.stat(FileName).st_mtime))class