Reputation: 303
say I have a folder that contains 10000 images whenever I want to read the path of the images folder I use imutils here:
import imutils as paths
path=list(paths.list_images(folderpath))
now assume that my folder contains 10000 images with names ("1.jpg","2.jpg","3.jpg",etc.)
now what i want is that path list contain the path of each image but when i display it gives me this
["path\1.jpg","path\10.jpg","path\100.jpg","path\1000.jpg","path\10000.jpg"]
so how to fix this issue?
Upvotes: 0
Views: 467
Reputation: 11
Have you tried os.walk?
import os
for root, dirs, files in os.walk(".", topdown=False):
for name in files:
if ".jpg" in name:
path_name = os.path.join(root, name)
Upvotes: 1