I have the following list:
list = [(1,info1),(2,info2),(3,info3)...]
each info is consisted of a list of tuples
info1 = [(a1,b1,c1),(a1',b1',c1'),(a1",b1",c1")...]
for each element in list
, i want to have the following:
otherlist = [(1,(a1,b1,c1)),(1,(a1',b1',c1')),(1,(a1",b1",c1"))...]
that is: the index in front of info
to be placed in front of each tuple of info
I think this is doable, but I am not able to achieve this with simple list comprehension
Thanks for the help :)
otherlist = [(x[0],y) for x in first_list for y in x[1]]