💾 Archived View for tris.fyi › pydoc › pprint captured on 2023-01-29 at 03:27:46. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2022-01-08)

🚧 View Differences

-=-=-=-=-=-=-

Back to module index

Go to module by name

pprint

Support to pretty-print lists, tuples, & dictionaries recursively.

Very simple, but useful, especially in debugging data structures.

Classes
-------

PrettyPrinter()
    Handle pretty-printing operations onto a stream using a configured
    set of formatting parameters.

Functions
---------

pformat()
    Format a Python object into a pretty-printed representation.

pprint()
    Pretty-print a Python object to a stream [default is sys.stdout].

saferepr()
    Generate a 'standard' repr()-like value, but protect against recursive
    data structures.


Classes

PrettyPrinter

format(self, object, context, maxlevels, level)

  Format object for a specific context, returning a string
          and flags indicating whether the representation is 'readable'
          and whether the object represents a recursive construct.
        
isreadable(self, object)
isrecursive(self, object)
pformat(self, object)
pprint(self, object)

Functions

isreadable

isreadable(object)

  Determine if saferepr(object) is readable by eval().

isrecursive

isrecursive(object)

  Determine if object requires a recursive representation.

pformat

pformat(object, indent=1, width=80, depth=None, *, compact=False, sort_dicts=True, underscore_numbers=False)

  Format a Python object into a pretty-printed representation.

pp

pp(object, *args, sort_dicts=False, **kwargs)

  Pretty-print a Python object

pprint

pprint(object, stream=None, indent=1, width=80, depth=None, *, compact=False, sort_dicts=True, underscore_numbers=False)

  Pretty-print a Python object to a stream [default is sys.stdout].

saferepr

saferepr(object)

  Version of repr() which can handle recursive data structures.

Modules

re