python: which file is newer & by how much time

隐身守侯 提交于 2019-12-01 05:24:54

There is a solution for that already:

import os
modified_time = os.stat(path).st_mtime # time of most recent content modification
diff_time = os.stat(path_1).st_mtime - os.stat(path_2).st_mtime

Now you have the time in seconds since Epoch. why are you creating a new representation, you can create a deltatime or whatever from this, why invent a new format?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!