How to pretty print nested dictionaries? - Stack Overflow How can I pretty print a dictionary with depth of ~4 in Python? I tried pretty printing with pprint(), but it did not work: import pprint pp = pprint PrettyPrinter(indent=4) pp pprint(mydict) I s