Photo by LNLNLN on Pixabay

Your Python Output Can Be Prettier

From basic to advance usage of the Python Pretty Printer library

--

Every programming language can output. Print variables in the console can be considered as the most elementary debugging method — at least you know what it contains. This is even more true for Python if you’re using interactive notebooks such as Jupyter Notebook, because the output is all you have after running a cell.

However, have you been bothered with the format of the output? For example

  • A dictionary with many key-value pairs that are printed in a single line
  • A nested list is printed in a single line that is not human-readable
  • A dictionary with uninterested nested objects that are very deep

You may have already known the Pretty Printer library in Python, or maybe not. No matter which case is right for you, this article will try to guide you into it and have a deep dive.

Be noticed that the Pretty Printer library is built-in to Python so you don’t need to download anything.

1. Basic Usage

--

--