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!


Did you find an issue in this article?

- click on the following Github link
- log into Github with your account
- click on the line number containing the error
- click on the "..." button
- choose "Reference in new issue"
- add a title and your comment
- click "Submit new issue"

Your feedback is much appreciated! πŸ€œπŸΌπŸ€›πŸΌ

You can also drop me a line below!