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

后端 未结 6 1190
清酒与你
清酒与你 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条回答
  •  不知归路
    2021-01-12 09:02

    Example for a list of files in current directory. You can expand this for specific paths.

    import glob
    movlist = glob.glob('*.mov')
    

提交回复
热议问题