Skip to content

pprint

Source

Wraps python pprint builtin.Link

Inputs

Name Type Default Required Description
objects Any None False The object to be pretty printed.
indent int 1 True Specifies the amount of indentation added for each nesting level.
width int 80 True Specifies the desired maximum number of characters per line in the output. If a structure cannot be formatted within the width constraint, a best effort will be made.
depth int None False Controls the number of nesting levels which may be printed; if the data structure being printed is too deep, the next contained level is replaced by .... By default, there is no constraint on the depth of the objects being formatted.
compact bool False True Impacts the way that long sequences (lists, tuples, sets, etc) are formatted. If compact is false (the default) then each item of a sequence will be formatted on a separate line. If compact is true, as many items as will fit within the width will be formatted on each output line.
sort_dicts bool True True If sort_dicts is true (the default), dictionaries will be formatted with their keys sorted, otherwise they will display in insertion order.
underscore_numbers bool False True If underscore_numbers is true, integers will be formatted with the _ character for a thousands separator, otherwise underscores are not displayed (the default).

Arguments

Position Argument Type
1 objects Any

Returns

NoneType

Examples

Basic pprint

stuff:
  and: things
pprint->: pprint "{{ stuff }}" # Will pretty print `and: things`