Skip to content

Instantly share code, notes, and snippets.

@hktechn0
Created December 7, 2009 07:10
Show Gist options
  • Save hktechn0/250680 to your computer and use it in GitHub Desktop.
Save hktechn0/250680 to your computer and use it in GitHub Desktop.
print dict for python
#!/usr/bin/env python
def print_dict(dic, h = ""):
print "%s{" % h
for d in dic:
print " %s%s\t:" % (h, d),
if isinstance(dic[d], dict):
print ""
print_dict(dic[d], h + " ")
else:
print dic[d]
print "%s}" % h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment