How to get list of files in directory with extension with Python

Python glob module finds all the pathnames matching a specified pattern.

import glob, os
for file in glob.glob("*.zip"):
  • N.B.! The results are returned in arbitrary order.
  • Note that glob module is built in and does not require any modules to work.