Pretty Print Plus Plus
pprintpp is a Python library that provides a drop-in replacement for the standard library's `pprint` module. Its main goal is to produce more aesthetically pleasing and readable output for complex data structures like dictionaries and lists, especially with improved indentation and line wrapping. The current version is 0.4.0, and it generally follows a stable, infrequent release cadence given its focused utility.
Warnings
- gotcha While advertised as a 'drop-in replacement' for `pprint`, `pprintpp` primarily focuses on improving the visual aesthetics of the output. There might be subtle behavioral differences or edge cases where `pprintpp` does not behave *identically* to the standard library's `pprint` module beyond just formatting, though such cases are rare for typical usage.
- gotcha The `pprintpp` library has not seen active development or new releases in a couple of years (as of 2024). While its core functionality is stable and it serves its purpose well, users seeking support for very new Python features, advanced `pprint` options, or prompt bug fixes might find the project's maintenance to be limited.
Install
-
pip install pprintpp
Imports
- pprintpp
import pprintpp
- pprint
import pprintpp as pprint
Quickstart
import pprintpp
data = {
'name': 'John Doe',
'age': 30,
'isStudent': False,
'courses': [
{'title': 'History I', 'credits': 3, 'grade': 'A'},
{'title': 'Math II', 'credits': 4, 'grade': 'B+'},
{'title': 'Literature', 'credits': 3, 'grade': 'A-'}
],
'address': {
'street': '123 Main St',
'city': 'Anytown',
'zip': '12345'
}
}
print('--- Using standard pprint ---')
import pprint
pprint.pprint(data)
print('\n--- Using pprintpp ---')
pprintpp.pprint(data)