osdir.com


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

How Do You Replace Variables With Their Values?


Terry Reedy <tjreedy at udel.edu> writes:

> On 7/10/2019 6:37 PM, CrazyVideoGamez wrote:
>
> > 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'?
>
> starters = dinner['Starters']
> main_course = dinner['Main Course']
> desert = dinner['Desert']

The question comes, though, why you (CrazyVideoGamez) are doing this.

You have the lists immediately accesible as dictionary elements, by
name.

Why do you need to also have them bound to separate names; what problem
are you trying to solve that you think this will help?

-- 
 \           ?If [a technology company] has confidence in their future |
  `\      ability to innovate, the importance they place on protecting |
_o__)     their past innovations really should decline.? ?Gary Barnett |
Ben Finney