Suppose I have these tuples:
('eggs', 20, 30)
('eggs', 40, 23)
('eggs', 10, 24)
('apple', 2, 22)
('apple', 42, 3)
I want a dictionary to look like this:
{
eggs: [[20, 30], [40,23], [10,24]],
apple: [[2,22], [42,3]]
}
How would I get this
I tried doing this:
dic = {}
for d in data:
dic[d[0]] += [[d[1], d[2]]
#d[0] being eggs or apple, d[1] and d[2] being the numbers