Skip to content

Instantly share code, notes, and snippets.

Forked from EdwardBetts/
Created June 14, 2020 18:00
What would you like to do?
Python pprint with color syntax highlighting for the console
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())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment