Python iteration through dictionnaries

Date: 2013-07-17 Tags: python

We create a dictionary called “d”:

d = {'site1': {'servername': 'test.org', 'serveralias': 'www.test.org'}}

We parse it with iteritems():

for key, value in d.iteritems():
    print key
    print value['servername']



Thanks for reading this post!


If you found an issue in this article, you can create an issue on Github.

If you have a comment or question, please drop me a line below!