Python Forum
Need to refer to Value of a key of a dictionary nested within a dictionary
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need to refer to Value of a key of a dictionary nested within a dictionary
#2
Quote:What I'm trying to do is print out the Character held in 'onScreen' by for-looping through the dictionary in the make_grid() function. Of course this would be easy if it was a list, but... it's not!
You can loop through a dictionary too

for k,v in list.items():
	print(v['onScreen'])
You also do not need to import future print on 2.7.10

and you should not overwrite "list" built-in

https://repl.it/X3G/4836
Recommended Tutorials:
Reply


Messages In This Thread
RE: Need to refer to Value of a key of a dictionary nested within a dictionary - by metulburr - Oct-02-2016, 01:00 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Sort a list of dictionaries by the only dictionary key Calab 2 610 Apr-29-2024, 04:38 PM
Last Post: Calab
Question Using Lists as Dictionary Values bfallert 8 399 Apr-21-2024, 06:55 AM
Last Post: Pedroski55
  Matching Data - Help - Dictionary manuel174102 1 423 Feb-02-2024, 04:47 PM
Last Post: deanhystad
  Dictionary in a list bashage 2 594 Dec-27-2023, 04:04 PM
Last Post: deanhystad
  filtering a list of dictionary as per given criteria jss 5 734 Dec-23-2023, 08:47 AM
Last Post: Gribouillis
  need to compare 2 values in a nested dictionary jss 2 900 Nov-30-2023, 03:17 PM
Last Post: Pedroski55
  python dictionary is that a bug ? rmangla 2 608 Sep-27-2023, 05:52 AM
Last Post: DPaul
  python dictionary syntax nafshar 2 901 Apr-24-2023, 07:26 PM
Last Post: snippsat
  Printing specific values out from a dictionary mcoliver88 6 1,474 Apr-12-2023, 08:10 PM
Last Post: deanhystad
  How to add list to dictionary? Kull_Khan 3 1,038 Apr-04-2023, 08:35 AM
Last Post: ClaytonMorrison

Forum Jump:

User Panel Messages

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