PyDocs

Nav

Data Types

pp

pprint

function · Added in 3.8 (source)
  • pp(object, stream=None, indent=1, width=80, depth=None, *, compact=False, expand=False, sort_dicts=False, underscore_numbers=False)
Pretty-print a Python object
Changed in 3.10, 3.11, 3.15
  • 3.10: Added the underscore_numbers parameter.
  • 3.11: No longer attempts to write to sys.stdout if it is None.
  • 3.15: Added the expand parameter.
1 Example
>>> import pprint
>>> stuff = ['spam', 'eggs', 'lumberjack', 'knights', 'ni']
>>> stuff.insert(0, stuff)
>>> pprint.pp(stuff)
[<Recursion on list with id=...>,
 'spam',
 'eggs',
 'lumberjack',
 'knights',
 'ni']
from the Python docs
See Also
No see-alsos for pprint/pp
0 Notes
No notes for pp