I am new to python. I'm extracting two rows from a csvfile.
Foodlist = ['apple, carrot, banana','chocolate, apple', 'strawberry, orange, carrot']
And the quantity list corresponds to each of the items in its sequence.
Quantity = ['1,2,1','2,5','1,2']
How can i merge the two list with common keys into a dictionary? I tried splitting and joining but the quantity gets overwritten due to the common keys.
I am trying to output:
{'Apple: totalquantity','Banana: totalquantity',
'Carrot: totalquantity','Chocolate: totalquantity',
'orange: totalquantity', 'strawberry: totalquantity'}
Please help!
Will there be anyway where i can extract the csvfile row for the food items and assign its values in a dictionary?
for cvs file is as follows:
row 1: apple, carrot, banana chocolate, apple strawberry, orange, carrot
row 2: 1,2,1 2,5 1,2