小编use*_*r4k的帖子

使用Python获取目录(包括子目录)的最后修改日期?

我想获取目录的最后修改日期和时间.在这样做时,我想包括子目录的最后修改日期.

我可以找到一些与这个问题相关的主题.(如何在Python中获取文件创建和修改日期/时间?)但所有这些只是给出根目录的最后修改时间而不考虑子目录.

import os.path, time
print "last modified: %s" % time.ctime(os.path.getmtime(file))
print "created: %s" % time.ctime(os.path.getctime(file))
Run Code Online (Sandbox Code Playgroud)

这些代码行只是给出了根目录的最后修改时间,而没有考虑子目录.请帮帮我.

python

5
推荐指数
1
解决办法
9088
查看次数

标签 统计

python ×1