<分区>
Possible Duplicate:
In Python, fastest way to build a list of files in a directory with a certain extension
我目前正在使用 os.walk 递归扫描一个识别 .MOV 文件的目录
def fileList():
matches = []
for root, dirnames, filenames in os.walk(source):
for filename in fnmatch.filter(filenames, '*.mov'):
matches.append(os.path.join(root, filename))
return matches
我如何扩展它以识别多个文件,例如 .mov、.MOV、.avi、.mpg?
谢谢。