Skip to content
Advertisement

Processing files in sorted order

I have 67 images in a directory with names as:

JavaScript

Files are jpg files Im_260x_y where x is the number of images 1..67, y are 0, 1, 4, 8, 16, 32, 64, 128, 258. These files are randomly stored in the directory.

I want to process the files in sorted order (same order which I have written above i.e Image 1 for all of 0, 1, 4, 8, 16, 32, 64, 128, 258. Then image 2 for all of 0, 1, 4, 8, 16, 32, 64, 128, 258 and so on).

How can I write Python code for this?

Advertisement

Answer

You could do this:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement