0

Unfortunately, I do not have any code for this, because I don't know how this would be done. What I want to do is iterate through a folder (not directory) (named "images") and get all the images from that folder (not directory). Since these images will be added through a discord bot, I do not know how many images will be in that folder (not directory).

L8R
  • 401
  • 5
  • 21
  • https://docs.python.org/3/library/glob.html – BeRT2me Oct 09 '22 at 00:06
  • Welcome to Stack Overflow. Please read [ask], and [please try](https://meta.stackoverflow.com/questions/261592) to look for existing solutions before posting. It is [as easy as writing `python` and then copying and pasting your question title after that, into a search engine](https://duckduckgo.com/?q=python+How+to+iterate+through+a+folder%3F). – Karl Knechtel Oct 09 '22 at 00:13
  • Did you try clicking the long link in my comment? – Karl Knechtel Oct 09 '22 at 03:56

1 Answers1

0

try this

import glob
glob.glob("path/to/folder/*.jpg")

you may change the file format to .png or any format you are using.

se7en
  • 671
  • 4
  • 18