I need to sort images based on numbers in the file Name.
For example: [1.jpg, 10.jpg, 3.jpg... ]
I tired natsort library and sorted function the both give the same result
import glob
from natsort import natsorted
images =[]
for img in glob.glob('E:/train/image/*.jpg'):
images.append(img)
natsorted(images)
it Outputs: [1, 10, 11, 12, 2, 22, 3]
but it must be: [1, 2, 3, 10, 11, 12, 22]