I can't seem to find any information on how to correctly sort a list like this. My list looks something like this
["1. Banana", "2. Pear", "11. Apple", "5. Grapes", "4. Orange"]
Using sorted()
leaves me with the following
['1. Banana', '11. Apple', '2. Pear', '3. Orange', '4. Grapes']
and I would like it to come out like this
['1. Banana', '2. Pear', '3. Orange', '4. Grapes', '11. Apple']
If it adds any complications I need to use this to sort a list of dictionaries using a specific key's value, so my current code is
list.sort(key=lambda k: k["key"])