Created
November 12, 2010 23:46
-
-
Save urschrei/674908 to your computer and use it in GitHub Desktop.
Do things with lists in nested dictionaries
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import os | |
import itertools | |
things = { | |
'thing_1' : { | |
'country':'France', | |
'people':'authors', | |
'people_names':['Stendhal', 'Flaubert'] | |
}, | |
'thing_2' : { | |
'country':'Ireland', | |
'people':'authors', | |
'people_names':['Yeats', 'Joyce'] | |
} | |
} | |
for things_name, things_dict in things.iteritems(): | |
print '%s:' % things_dict['country'] | |
for the_authors in things_dict['people_names']: | |
print '\t%s' % the_authors |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment