I have multiple lists like following-
list1=['Tom']
list2=[16]
list3=['Maths','Science','English']
list4=['A','B','C']
I want to zip these lists to achieve the following mapping-
desired results-
[('Tom', 16, 'Maths','A'), ('Tom', 16, 'Science','B'), ('Tom', 16, 'English','C')]
Result i am getting by using the following command-
results=zip(list1,list2,list3,list4)
[('Tom', 16, 'Maths','A')]
this is just an example of my problem.If a generalised solution is provided it would be helpful. If I use the statement-
res= itertools.izip_longest(*[x[c] for c in cols])
I am getting multiple rows but getting null for the name and age column. Also consider passing the column names in the above way since the names of columns are not static.