& Ldquo; TypeError: The 'module' object is not callable & rdquo; Trying to use pprint

advertisements

I've tried this code to pretty print a dict:

import pprint

pprint({})

This throws the following error:

Traceback (most recent call last):
  File "temp.py", line 3, in <module>
    pprint({})
TypeError: 'module' object is not callable

Why is it not callable?


Try importing using:

from pprint import pprint

The pprint() function is in the pprint module.