Hopefully a quick python question here…
import plistlib
pl = plistlib.readPlist('/Users/name/Documents/some.plist')
print(pl[0]['keyA'] , pl[0]['keyD'] , pl[0]['keyG'])
how would I write a for loop or a list function that would cycle through a dictionary printing the values to certain keys.
The main dictionary will have say 30 entries (dictionaries in the dictionary) with each one having about 40 keys within.)
Example:
print(pl[0]['keyA'] , pl[0]['keyD'] , pl[0]['keyG'])
print(pl[1]['keyA'] , pl[1]['keyD'] , pl[1]['keyG'])
print(pl[2]['keyA'] , pl[2]['keyD'] , pl[2]['keyG'])
print(pl[n]['keyA'] , pl[n]['keyD'] , pl[n]['keyG'])
where pl is the main dictionary and then 0 - n refer to the dictionaries within the dictionary.
I hope this makes sense
Just write it! :p
(
.values()says to iterate over the values of the dictionary, since normally iterating over a dictionary goes through its keys. In Python 2 use.itervalues()instead.)