python temukan file rekursif
import glob
files = glob.glob(path + "/**/*.txt", recursive = True)
Kind Kangaroo
import glob
files = glob.glob(path + "/**/*.txt", recursive = True)
def walk_ext_file(dir_path, ext_list):
# @dir_path参数:遍历的目录
# @ext_list参数:拓展名列表,例['.mp4', '.mkv', '.flv']
# 遍历
for root, dirs, files in os.walk(dir_path):
# 获取文件名称及路径
for file in files:
file_path = os.path.join(root, file)
file_item = os.path.splitext(file_path)
# 输出指定扩展名的文件路径
if file_item[1] in ext_list:
print(file_path)http://www.showmeai.tech/article-detail/python-os-file-dir-methods#%E9%81%8D%E5%8E%86%E6%93%8D%E4%BD%9C