↧
Answer by Mihai Alexandru-Ionut for Sort a list of names containing numbers...
Since all the strings of your given list are ended in .avi extension, you could use a slicing feature. sorted(lst, key=lambda x: int(x[:-4]))
View ArticleAnswer by Eugene Yarmash for Sort a list of names containing numbers by the...
You can use a custom sorting function to extract the number from each element of the list and use it as the comparison key. You'd need to convert it to int to ensure it compares like number:...
View ArticleSort a list of names containing numbers by the numeric value
I would like to sort a list which includes a set such as; 100.avi 10000.avi 10002.avi 1003.avi .... I need to do some process using the files in numeric order. If I use sorted it does not care about...
View Article