最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

python 查找文件夾下所有文件 實(shí)現(xiàn)代碼

 更新時(shí)間:2009年07月01日 00:48:05   作者:  
python 查找文件夾下所有文件,需要的朋友可以參考下。
復(fù)制代碼 代碼如下:

def find_file_by_pattern(pattern='.*', base=".", circle=True):
'''''查找給定文件夾下面所有 '''
re_file = re.compile(pattern)
if base == ".":
base = os.getcwd()

final_file_list = []
print base
cur_list = os.listdir(base)
for item in cur_list:
if item == ".svn":
continue

full_path = os.path.join(base, item)
if full_path.endswith(".doc") or \
full_path.endswith(".bmp") or \
full_path.endswith(".wpt") or \
full_path.endswith(".dot"):
continue

# print full_path
bfile = os.path.isfile(item)
if os.path.isfile(full_path):
if re_file.search(full_path):
final_file_list.append(full_path)
else:
final_file_list += find_file_by_pattern(pattern, full_path)
return final_file_list

相關(guān)文章

最新評(píng)論

原平市| 萨迦县| 宣武区| 西贡区| 沙洋县| 柞水县| 古浪县| 武川县| 共和县| 翁牛特旗| 临海市| 秦皇岛市| 涟水县| 鹤山市| 江油市| 靖江市| 舟山市| 泉州市| 阿坝县| 永城市| 阿拉善右旗| 江川县| 日照市| 普兰县| 寻乌县| 云霄县| 同德县| 团风县| 正定县| 长沙县| 大埔县| 丰台区| 信阳市| 方正县| 开封县| 武鸣县| 班戈县| 基隆市| 吉木萨尔县| 九龙县| 正阳县|