The pprint Module
The pprint
module
pretty-prints complicated data structures, with formatting that may
be more readable than that supplied by built-in function
repr
(see Chapter 8). To
fine-tune the formatting, you can instantiate the
PrettyPrinter
class supplied by module
pprint
and apply detailed control, helped by
auxiliary functions also supplied by module
pprint
. Most of the time, however, one of the two
main functions exposed by module pprint
suffices.
Get Python in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.