Python 寻找文件夹里以特定格式结尾的文件

Posted monogem

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Python 寻找文件夹里以特定格式结尾的文件相关的知识,希望对你有一定的参考价值。

代码:

import os, re, time


name = linuxday01
flags = True
# 文件夹bi_test中的文件列表
print os.listdir(E:\\bi_test) while flags: for f in os.listdir(E:\\bi_test):
     # 寻找以name开头,以.download结尾的文件
if re.search(name + \.(.*)\.download$, f): print f print 没有完成 time.sleep(5) #flags =False print 完成
# 当前时间
print time.strftime(‘%Y-%m-%d %H:%M:%S‘,time.localtime())
 

 

以上是关于Python 寻找文件夹里以特定格式结尾的文件的主要内容,如果未能解决你的问题,请参考以下文章