osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How Do You Replace Variables With Their Values?


How do you replace a variable with its value in python 3.7.2? For example, say I have:

dinner = {'Starters':['Fried Calamari', 'Potted crab'],'Main Course':['Fish', 'Meat'], 'Desert':['Cake', 'Banana Split']}

# Don't ask where I got the dinner from

for meal in dinner.keys():
        meal = list(dinner[meal]

But I only get one list called "meal" and I'm just changing it with the code above (you can find that by printing it out). How can I make separate lists called 'Starters', 'Main Course', and 'Desert'?