Skip to content

Instantly share code, notes, and snippets.

@guinslym
Forked from EdwardBetts/pprint_color.py
Last active August 29, 2015 14:22
Show Gist options
  • Save guinslym/aa0d0d8660973b3df814 to your computer and use it in GitHub Desktop.
Save guinslym/aa0d0d8660973b3df814 to your computer and use it in GitHub Desktop.
from pygments import highlight
from pygments.lexers import PythonLexer
from pygments.formatters import Terminal256Formatter
from pprint import pformat
def pprint_color(obj):
print highlight(pformat(obj), PythonLexer(), Terminal256Formatter())
@guinslym
Copy link
Author

Python pprint with color syntax highlighting for the console

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment