python3 文件夹查找文件


import glob, os
def all_files(pattern, search_path, pathsep = os.pathsep):
  for path in search_path.split(pathsep):
    for match in glob.glob(os.path.join(path, pattern)):
      yield match
aaa=all_files('4_*', r"E:\git_project\mouse_detect_demo\mouse_data\mouse_picp")
# print(all_files('*.s', r"E:\git_project\mouse_detect_demo\mouse_data\mouse_picp").__next__())
for match in aaa:
  print(match)

你可能感兴趣的:(python)