I need to sort the following list of tuples in Python:
ListOfTuples = [('10', '2010 Jan 1;', 'Rapoport AM', 'Role of antiepileptic drugs as preventive agents for migraine', '20030417'), ('21', '2009 Nov;', 'Johannessen SI', 'Antiepilepticdrugs in epilepsy and other disorders--a population-based study of prescriptions', '19679449'),...]
My goal is to order his Descending year (listOfTuples [2]) and the Rising Author (listOfTuples [2]):
sorted(result, key = lambda item: (item[1], item[2]))
But that will not work. How can I get sorting stability?
source
share