I have a list of files each named after a camera. In the Finder on a Mac, if I sort them by "Name" the first three are in this order:
1D 5D 10D
However, in another application, the same list of files is sorted like this:
10D 1D 5D
Notice the 10D moved from the bottom to the top of the list. I think this is because the the second app is favoring numbers over letters. It's like because "0" is a number it has a higher placement than "D".
In Python, I have written a script that accepts a folder of files and adds them to a list. But I need the list to be sorted the same way the second app sorts them, not the way the Finder sorts them. I think the solution might have to do with the sorted()
function and the key
parameter but beyond that I'm not sure what to do.
For those of you who want to see code:
myList = ["1D", "5D", "10D"]
sorted(myList, key=theSolutionToMyProblem)
print myList
>>>["10D", "1D", "5D"]
If I'm way off please tell me. Point me in the right direction.