Skip to content

Instantly share code, notes, and snippets.

@urschrei
Created November 12, 2010 23:46
Show Gist options
  • Save urschrei/674908 to your computer and use it in GitHub Desktop.
Save urschrei/674908 to your computer and use it in GitHub Desktop.
Do things with lists in nested dictionaries
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