Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
dictionary question
#3
(Apr-01-2021, 09:17 PM)BashBedlam Wrote: The Apple that you want is the first element in the Banana dictionary not the first element in the Item dictionary. Sooo....

Item = {'Apple' : 10, 'Banana' : {'Apple' : 5, 'Banana' : 20}}
print (Item ['Banana']['Apple'])

you saved ma life bro thx
Reply


Messages In This Thread
dictionary question - by stereokim123 - Apr-01-2021, 09:12 PM
RE: dictionary question - by BashBedlam - Apr-01-2021, 09:17 PM
RE: dictionary question - by stereokim123 - Apr-01-2021, 10:23 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Dictionary question kam_uk 7 4,345 Nov-22-2020, 05:43 AM
Last Post: ndc85430

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020