Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to iterate through a folder?

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).

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

try this

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

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

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading