I’m wondering how can I check in a certain directory if it has a png image(it’s name can be anything). If yes, then save the name of the images in a list.
Thanks
>Solution :
You can use the glob library and "*" as a wildcard e.g.
import glob
pngs = glob.glob("yourdir/*.png") # len(pngs) == 0 means we have no matches
# ['image1.png', 'image2.png' ...]
See more examples here