|
|
|
|
|
by herge
3714 days ago
|
|
FWIW, the sort method (and sorted keyword) take a 'key' keyword, where you can pass a function to use to calculate the key to sort the sequence with. So in your file11 case, you can do: sorted(files, key=lambda x: int(x[4:]) , and it will do the right thing. Although with natsort, you don't have to parse the actual strings yourself. |
|