国产探花免费观看_亚洲丰满少妇自慰呻吟_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
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 湘潭县| 南充市| 哈巴河县| 顺昌县| 安义县| 安阳县| 云霄县| 兴山县| 延吉市| 泉州市| 三原县| 连云港市| 甘谷县| 涿州市| 海伦市| 雷州市| 大埔县| 石棉县| 海门市| 黎川县| 汶上县| 靖安县| 通许县| 五原县| 楚雄市| 屯留县| 聂拉木县| 开阳县| 孙吴县| 特克斯县| 海盐县| 基隆市| 蓬溪县| 威信县| 庆城县| 绿春县| 蒙城县| 绥江县| 会同县| 平乡县| 通化市|