Python analog of natsort function (sort a list using a "natural order" algorithm)
Posted
by Silver Light
on Stack Overflow
See other posts from Stack Overflow
or by Silver Light
Published on 2010-03-30T13:29:12Z
Indexed on
2010/03/30
13:33 UTC
Read the original article
Hit count: 151
I would like to know if there is something similar to PHP natsort function in python?
l = ['image1.jpg', 'image15.jpg', 'image12.jpg', 'iamge3.jpg']
l.sort()
gives:
['image1.jpg', 'image12.jpg', 'image15.jpg', 'iamge3.jpg']
but I would like to get:
['image1.jpg', 'iamge3.jpg', 'image12.jpg', 'image15.jpg']
© Stack Overflow or respective owner