In Python, fastest way to build a list of files in a directory with a certain extension

后端 未结 6 1290
清酒与你
清酒与你 2021-01-12 08:34

In Python on a GNU/Linux system, what\'s the fastest way to recursively scan a directory for all .MOV or .AVI files, and to store them in a list? <

6条回答
  •  Happy的楠姐
    2021-01-12 08:50

    You can use os.walk() for recuresive walking and glob.glob() or fnmatch.filter() for file matching:

    Check this answer

提交回复
热议问题