def timeInterval(self):
today = datetime.date.today()
print today
modifiedTime = os.stat(filename).st_mtime//该文件的修改时间
modifiedTime = datetime.date.fromtimestamp(modifiedTime) //在这里转换年-月-日 格式
print modifiedTime
dayCount = (today - modifiedTime).days
print dayCount
或者最简单的:
start = time.time()
time_interval = time.time() - start