-
-
Save flyeagles/455614260f23843b41491add9979f24d to your computer and use it in GitHub Desktop.
Python pprint with color syntax highlighting for the console
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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