Member-only story

How to Generate Nice Text Formatting in System Terminal With python

Richard
3 min readMay 22, 2022

--

Rich is a Python library for writing rich text (with color and style) to the terminal, and for displaying advanced content such as tables, markdown, and syntax highlighted code.

Photo by Florian Olivo on Unsplash

Use Rich to make your command line applications visually appealing and present data in a more readable way. Rich can also be a useful debugging aid by pretty-printing and syntax highlighting data structures.

#Installation

python -m pip install rich

Then, run the following to test the Rich output on your terminal:

python -m rich

output

#Quick Start

The quickest way to get up and running with Rich is to import the alternative print function which takes the same arguments as the built-in print and maybe used as a drop-in replacement. Here’s how you would do that:

from rich import printprint("[italic red]Hello[/italic red] World!", locals())

output:

--

--

Richard
Richard

No responses yet

Write a response