找出指定文件夹中的所有以txt结尾的文件,包括所有嵌套的子文件夹
2013-12-20 17:43
295 查看
# coding:utf-8
import os, re
for i in os.walk('d:'+os.sep):
for txt in i[2]:
try:
txt = re.match(r'(.*)(\.txt)', txt).group(0)
print os.path.join(i[0], txt)
except:
pass
import os, re
for i in os.walk('d:'+os.sep):
for txt in i[2]:
try:
txt = re.match(r'(.*)(\.txt)', txt).group(0)
print os.path.join(i[0], txt)
except:
pass
相关文章推荐
- Linux column命令详解(每日一令之二十一)
- PHP变量的定义、可变变量、变量引用、销毁方法
- Source Insight使用
- hadoop错误
- 给未来的宝贝
- 有时候,回忆也是一种幸福
- Windows 下OpenSSL 安装
- 网页中显示内容过多,如何从bottom回到top
- editplus保存时不生成bak文件
- APP简介
- 未知的事情,发生在未知的时候
- wpf 在 AddNew 或 EditItem 事务过程中不允许“DeferRefresh”。
- 代码混淆时报jpush的错误
- 有关日期的一个问题
- iOS 数据持久化(四)SQLite3
- XY8782S00 BL-W8782 BL-R8782MS1 SDIO接口 高性能、低功耗、体积小 wifi无线模块
- 第五章(Web Service)
- 很多的身不由己,很多的美好时光
- 安装nagios-cn出现的问题!
- c# 异常信息处理