Created
March 16, 2017 05:48
-
-
Save sidja/aaa3b4081b905b09930e80462c841bdc to your computer and use it in GitHub Desktop.
pretty print your dictionary values
This file contains 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
def pretty(d, indent=0): | |
for key, value in d.iteritems(): | |
print '\t' * indent + str(key) | |
if isinstance(value, dict): | |
pretty(value, indent+1) | |
else: | |
print '\t' * (indent+1) + str(value) | |
pretty(a, indent=3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment