I want to convert a tuples list into a nested list using Python. How do I do that?
I have a sorted list of tuples (sorted by the second value):
[(1, 5), (5, 4), (13, 3), (4, 3), (3, 2), (14, 1), (12, 1),
(10, 1), (9, 1), (8, 1), (7, 1), (6, 1), (2, 1)]
Now I want it to have like this (second value ignored and nested in lists):
[ [1], [5], [13, 4], [3], [14, 12, 10, 9, 8, 7, 6, 2] ]
I ve seen other threads in here with map
used for such things, but I don t completely understand it. Can anyone provide insight as to the correct python way of doing this?