How to Solve NameError: name 'pformat' is not defined -- pprint

Solution: Import the 'pformat' module

To Solve the error, add the following line to the top of your code.

from pprint import pformat

 

For more information:
Python pprint pformat