Python Forum
Accessing nested dictionary values. Plistlib, Python 2.7
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Accessing nested dictionary values. Plistlib, Python 2.7
#14
just to make sure you understand:
1.y is a dict
2. y['_items'] is a list of dicts, so I don't know how many elements it has, so we must iterate. of course you can access elements by index like you did y['_items'][0] but you don't know if there are more elements...
3. each of the dicts (item) that we iterate over in step 2 has again an element with key '_items' which is again list of dicts.
4. we iterate over these (item2)
5. each item2 is a dict that has element with key 'volumes' which is a list of dicts
6. we iterate over these lists (volume) and extract element with key 'size'
Reply


Messages In This Thread
RE: Accessing nested dictionary values. Plistlib, Python 2.7 - by buran - Sep-26-2017, 07:22 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Replace values in Yaml file with value in dictionary PelleH 0 168 Jun-12-2024, 02:40 PM
Last Post: PelleH
Question Using Lists as Dictionary Values bfallert 8 708 Apr-21-2024, 06:55 AM
Last Post: Pedroski55
  need to compare 2 values in a nested dictionary jss 2 1,020 Nov-30-2023, 03:17 PM
Last Post: Pedroski55
  Printing specific values out from a dictionary mcoliver88 6 1,620 Apr-12-2023, 08:10 PM
Last Post: deanhystad
  Accessing same python script from multiple computers bigrockcrasher 1 1,841 May-25-2022, 08:35 PM
Last Post: Gribouillis
  Python modules for accessing the configuration of relevant paths Imago 1 1,512 May-07-2022, 07:28 PM
Last Post: Larz60+
Question How to print each possible permutation in a dictionary that has arrays as values? noahverner1995 2 1,892 Dec-27-2021, 03:43 AM
Last Post: noahverner1995
  plistlib / xml file / get value except key Tecuma 6 3,437 May-26-2021, 03:51 PM
Last Post: Tecuma
  Nested dictionary acting strange Pedroski55 2 2,256 May-13-2021, 10:37 PM
Last Post: Pedroski55
  format the output from a nested dictionary. nostradamus64 9 4,913 May-03-2021, 04:45 PM
Last Post: nostradamus64

Forum Jump:

User Panel Messages

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