I have a list of lists in the following format:
[['Sarah', '12', 'Chocolate'],
['Anders', '11', 'Vanilla'],
['Sarah', '13', 'Strawberry'],
['John', '11', 'None'],
# ...
]
And I want to group the sublists as follows:
[['Sarah', '12', 'Chocolate', '13', 'Strawberry'],
['Anders', '11', 'Vanilla'],
['John', '11', 'None'],
# ...
]
Where I group by the first item of the sublists and order by the second (so Sarahs with age 12 come before Sarahs with age 13).
How to do this?