How Do You Replace Variables With Their Values?

Ben Finney ben+python at benfinney.id.au
Wed Jul 10 22:33:59 EDT 2019


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




More information about the Python-list mailing list