码迷,mamicode.com
首页 > 编程语言 > 详细

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

时间:2019-08-17 12:56:56      阅读:97      评论:0      收藏:0      [点我收藏+]

标签:import   flag   time()   class   imp   文件   flags   inux   code   

代码:

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 寻找文件夹里以特定格式结尾的文件

标签:import   flag   time()   class   imp   文件   flags   inux   code   

原文地址:https://www.cnblogs.com/monogem/p/11367914.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!