Quantcast
Channel: Sort a list of names containing numbers by the numeric value - Stack Overflow
Viewing all articles
Browse latest Browse all 3

Answer by Mihai Alexandru-Ionut for Sort a list of names containing numbers by the numeric value

$
0
0

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]))

Viewing all articles
Browse latest Browse all 3

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>