glob.glob
to find filesglob.glob
let's you find pathnames that follow a given pattern. It uses the same syntax as an Unix shell.
Example:
In [12]: import glob
In [13]: glob.glob('*.heic')
Out[13]:
['IMG_7645.heic',
'IMG_7653.heic',
'IMG_7652.heic',
'IMG_7644.heic',
'IMG_7643.heic',
'IMG_7654.heic',
'IMG_7651.heic',
'IMG_7646.heic']