У меня есть список с датой в форме для человека и форматом даты, я пытаюсь сортировать даты.Сортировка по дате Список Python
не возвращается правильный заказ.
d = ["[email protected], Aug 10, 2015", "[email protected], Aug 11, 2015", "[email protected], Aug 12, 2015","[email protected], Aug 13, 2015", "[email protected], Aug 14, 2015", "[email protected], Aug 07, 2015", "[email protected], Aug 08, 2015", "[email protected], Aug 09, 2015"]
>>> def sorting(L):
... splitup = L.split('-')
... return splitup[1], splitup[0]
...
>>> sorted(d, key=sorting)
['[email protected], Aug 10, 2015', '[email protected], Aug 11, 2015', '[email protected], Aug 12, 2015', '[email protected], Aug 13, 2015', '[email protected], Aug 14, 2015', '[email protected], Aug 07, 2015', '[email protected], Aug 08, 2015', '[email protected], Aug 09, 2015']