Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python sort file names with numbers

dirFiles = ['Picture 03.jpg', '02.jpg', '1.jpg']
dirFiles.sort(key=lambda f: int(''.join(filter(str.isdigit, f))))

print(dirFiles)
# ['1.jpg', '02.jpg', 'Picture 03.jpg']
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #sort #file #names #numbers
ADD COMMENT
Topic
Name
8+2 =