用glob查找多层文件夹下的特定文件类型?
import glob
file_list = []
for ext in ('*.pdf', '*.PDF'):
res_paths = os.path.join(directory, ext)
file_list.extend(glob.glob(res_paths))
for file in file_list:
pass
import glob
file_list = []
for ext in ('*.pdf', '*.PDF'):
res_paths = os.path.join(directory, ext)
file_list.extend(glob.glob(res_paths))
for file in file_list:
pass