import osdef anyTrue(predicate, sequence):return True in map(predicate, sequence)def filterFiles(folder, exts):for fileName in os.listdir(folder):if os.path.isdir(folder + '/' + fileName): filterFiles(folder + '/' + fileName, exts)elif anyTrue(fileName.endswith, exts):print fileNameexts = ['.md', '.yml', '.rst']filterFiles('D://Twisted//twisted-trunk', exts)import osimport timefrom itertools import imapdef anyTrue(predicate, sequence): return True in imap(predicate, sequence) def filterFiles(folder, exts): for fileName in os.listdir(folder): if os.path.isdir(folder + '/' + fileName): filterFiles(folder + '/' + fileName, exts) elif anyTrue(fileName.endswith, exts): print fileNamestart = time.time()exts = ['.md', '.yml', '.rst']filterFiles('D://Twisted//twisted-trunk', exts)print('total time=%f' %(time.time()- start))