国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Python > 正文

python 查找文件夾下所有文件 實現代碼

2020-02-23 04:44:20
字體:
來源:轉載
供稿:網友
代碼如下:
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
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 房产| 页游| 岳池县| 奇台县| 平顶山市| 麻江县| 长顺县| 江阴市| 涞水县| 乌兰县| 姚安县| 嘉禾县| 台中县| 伊川县| 大荔县| 鱼台县| 从江县| 镇坪县| 廊坊市| 盘锦市| 新乡市| 龙泉市| 大田县| 肥西县| 莎车县| 腾冲县| 东安县| 北川| 太白县| 简阳市| 长子县| 钟山县| 特克斯县| 株洲县| 青海省| 肃南| 仲巴县| 华宁县| 阳曲县| 昂仁县| 郧西县|