Overview
An alternate to the Python pprint module.
I use the "Data pretty printer" module frequently since it is very handy for displaying variables in Python. I didn't find the output formatting easily readable in many cases, so I created my own.
Screen Shot
A comparison between betterprint and pprint with the same data.
| betterprint | pprint |
![]() |
|
Installation
You can use easy_install (as root) using setuptools:
easy_install betterprint
Or you can download the module:
Or you see the source code online:
Or check out the source code using subversion:
svn co svn://slowchop.com/svn/misc/betterprint/trunk betterprint
Usage
Note for Windows users: This will not work too well on Windows unless your command prompt supports ANSI colour codes. The next version of better print will support Windows.
You can easily use betterprint without replacing all your pprint code by replacing your "import pprint" line with this:
try: import betterprint as pprint except ImportError: import pprint
This will simply attempt to import betterprint aliased to act like pprint, and quietly use pprint if betterprint is not available.

