【发布时间】:2015-11-15 09:02:15
【问题描述】:
假设结构如下:
People/
Jimmy/
my_Files/
work.txt
report.txt
Mohammad/
the_work/
something2.sth
something2.sth
如您所见,People 目录中的每个职员都有一个目录,每个职员在他/她的目录中都有很多文件或目录。
我想编写一个程序来接收日期作为输入并搜索这些目录并返回哪个职员在该日期之后没有修改任何文件!
我正在使用以下程序列出所有文件:
files_path= list()
for root,dirs,files in os.walk(r"G:\People"):
for filename in files:
files_path.append(root+filename)
以及下面的程序来接收它们的最后修改时间:
for single_file in files_path:
print "last modified: %s" % time.ctime(os.path.getmtime(single_file))
print "created: %s" % time.ctime(os.path.getctime(single_file))
好吧,两者都工作正常!问题是我无法将结果管理为具有用户对的可读输出:上次修改时间!
任何人都可以帮助我如何处理它以获得合理的输出列表吗?
【问题讨论】:
标签: python algorithm python-2.7 sorting