def find_file(path, reg):
    '\n    path: 要遍历的目录\n    reg: 符合条件的文件\n    '
    FileLst = []
    try:
        lst = os.walk(path)
        for (root, dirs, files) in lst:
            for name in files:
                try:
                    m = re.match(reg, name)
                except Exception as e:
                    continue
                if m:
                    FileLst.append(os.path.join(root, name))
    except Exception as e:
        print(str(e))
    return sorted(FileLst)
path: 要遍历的目录
reg: 符合条件的文件
def find_file(path, reg):
    '\n    path: 要遍历的目录\n    reg: 符合条件的文件\n    '
    FileLst = []
    try:
        lst = os.walk(path)
        for (root, dirs, files) in lst:
            for name in files:
                try:
                    m = re.match(reg, name)
                except Exception as e:
                    continue
                if m:
                    FileLst.append(os.path.join(root, name))
    except Exception as e:
        print(str(e))
    return sorted(FileLst)