Gentlemen, is there a quick and convenient way to go through the file folder in order of the files in it? os.walk, os.listdir, nothing helped me, I ran in different folders, but the result is the same - the files in the generated list are issued in random order. In the folder there are 26 files with the names _img_order number.png
code:
path = r"C:\Users\neir0\Desktop\studyV1\data\clean" print(sorted(os.listdir(path))) output: files are mixed
['_img_1.png', '_img_10.png', '_img_11.png', '_img_12.png', '_img_13.png', '_img_14.png', '_img_15.png', '_img_16.png', ' _img_17.png ',' _img_18.png ',' _img_19.png ',' _img_2.png ',' _img_20.png ',' _img_21.png ',' _img_22.png ',' _img_23.png ',' _img_24. png ',' _img_25.png ',' _img_26.png ',' _img_3.png ',' _img_4.png ',' _img_5.png ',' _img_6.png ',' _img_7.png ',' _img_8.png ' , '_img_9.png']
pending: list of files according to their location in the folder
sorted(os.listdir(PATHTODIR))can help. - mkkik