> For the complete documentation index, see [llms.txt](https://prof-rossetti.gitbook.io/intro-to-python/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://prof-rossetti.gitbook.io/intro-to-python/notes/python/modules/pprint.md).

# The pprint Module

The `pprint` module provides a way to "pretty print", or customize the formatting of print statements.

## Usage

Pretty-print:

```python
from pprint import pprint

pprint({"id": 1, "name": "Chocolate Sandwich Cookies", "aisle": "cookies cakes", "department": "snacks", "price": 3.5})
#> {'aisle': 'cookies cakes',
#>   'department': 'snacks',
#>   'id': 1,
#>   'name': 'Chocolate Sandwich Cookies',
#>   'price': 3.5}
```

Pretty-print using custom indentation settings:

```python
import pprint

pp = pprint.PrettyPrinter(indent=4)

pp.pprint({"id": 1, "name": "Chocolate Sandwich Cookies", "aisle": "cookies cakes", "department": "snacks", "price": 3.5})
#> {   'aisle': 'cookies cakes',
#>     'department': 'snacks',
#>     'id': 1,
#>     'name': 'Chocolate Sandwich Cookies',
#>     'price': 3.5}
```
