On 11/07/2019 05:51, Aldwin Pollefeyt wrote:
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():
exec(meal.replace(' ','_') + ' = list(dinner[meal])')
print(Starters)
print(Main_Course)
print(Desert)
OUTPUT:
['Fried Calamari', 'Potted crab']
['Fish', 'Meat']
['Cake', 'Banana Split']
If you think you need to do this, you are almost certainly wrong. Ew!
--
Rhodri James *-* Kynesim Ltd
--
https://mail.python.org/mailman/listinfo/python-list