I'm working with the enron email data set. It's a dictionary of dictionaries, where each name in the original dictionary is a key for a another set of features. Just to give an idea it would look something like this.
enron = {'Mark' : {'salary': 10, 'employed': 'yes'}, 'Ted' : {'salary': 5, 'employed': 'yes'}
Except the real data set is of course much larger with many more features. If I want to get a list of the features, I do something like:
for key in enron['Mark']:
print key
This works fine enough but seems kind of lazy. Is there a more generic function in Python that can automatically reach to a certain layer of dictionaries? I'm just afraid I might one day have to work with a multi-level dictionary, and I'd rather not have to write variations of:
for key in dic['a']['b']['c']
over and over again.