0

I want read image name like flower.png unnamed.png. Is there any way that I can read all images images one by one like we can read text file with open ("data.txt", "r") as myfile: data = myfile.read().splitlines().. Hope you will give me a solution thanks

enter code here from PIL import Image
 import glob
 image_list = []
       for filename in glob.glob('yourpath/*.img'):
       im=Image.open(filename)
       image_list.append(im)
  • Did you tried this? https://stackoverflow.com/questions/3207219/how-do-i-list-all-files-of-a-directory and https://stackoverflow.com/questions/3964681/find-all-files-in-a-directory-with-extension-txt-in-python – SergeiMinaev Jul 01 '22 at 14:55
  • @SergeiMinaev Thanks for your response .. I tried some of them coding which isn't working for me. I want scrape all image name from a folder.. That's it – M A Nezam Sagor Jul 01 '22 at 15:00

1 Answers1

1

If you want to get all file name from a folder, you can use os.listdir

import os
filename = os.listdir("YOUR_FOLDER_NAME")