3

I'm trying to save .jpg files one by one into folders that have the same name.

For example:
012454.jpg into folder 012454
000767.jpg into folder 000767

I've already created the folders but I cannot change the path of the images using a loop

for filename in os.listdir(path):
    filename = filename[:-4]
    os.mkdir(filename)
John Kugelman
  • 349,597
  • 67
  • 533
  • 578

0 Answers0