---
title: '|pprint'
description: Pretty prints a Python object. Used for debugging.
date: '2026-08-02'
categories:
  - Filter
  - Coding
canonical: https://www.djangotemplatetagsandfilters.com/filters/pprint/
doc_link: https://docs.djangoproject.com/en/6.0/ref/templates/builtins/#pprint
---

# |pprint

Pretty prints a Python object. Used for debugging.

## Documentation

Pretty prints a Python object using [`pprint.pprint`](https://docs.python.org/3/library/pprint.html#pprint.pprint) wrapper.

### Variable

```django
context['classes'] = {
    'Python': [
        'Introduction to Python Training', 'Advanced Python Training',
        'Data Science Training', 'Django Training'
    ],
    'Databases': [
        'Introduction to PostgreSQL Training', 'Introduction to MySQL Training',
        'Introduction to SQL Server Training', 'Introduction to Oracle Training'
    ],
    'Web': [
        'HTML Training', 'CSS Training', 'JavaScript Training'
    ],
    'XML': [
        'Introduction to XML Training'
    ]
}
```

### Template

```django
<pre>{{ classes|pprint }}</pre>
```

### Result

```django
{'Databases': ['Introduction to PostgreSQL Training',
               'Introduction to MySQL Training',
               'Introduction to SQL Server Training',
               'Introduction to Oracle Training'],
 'Python': ['Introduction to Python Training',
            'Advanced Python Training',
            'Data Science Training',
            'Django Training'],
 'Web': ['HTML Training', 'CSS Training', 'JavaScript Training'],
 'XML': ['Introduction to XML Training']}
```

## Commentary

Could be useful for debugging, though you can do the same thing at the console.
