Runtime Inspection Modules
pprint
Formats Python data structures for easier reading, controlling line width, depth and dictionary ordering. pformat returns a string rather than printing. Output is intended for inspection, not reliable serialization; representations may contain object-specific text.
Formal Syntax & Structure
python syntaxpython
import pprintReturn Value
module
Module namespace available through import; import is a statement, not a value-returning expression.
Working Example
Example Snippetpython
from pprint import pformatdata = {"b": 2, "a": 1}print(pformat(data, sort_dicts=True))