Generate simple tables in terminals from a nested list of strings. Fork of terminaltables.
Maintained. Last release 3 weeks ago, commits in 2 of the last 26 weeks. Weaker on commit activity and release cadence.
pip install terminaltables3What is it
Easily draw tables in terminal/console applications from a list of lists of strings. Supports multi-line rows.
Tested on Python 3.8+
This is a fork of the terminaltables project. Which is archived and unmaintained. This library is in a new namespace but should otherwise be a drop in replacement. Maintaining goals consist of maintaining ecosystem compatibility, type annotations and responding to community pull requests.
To Upgrade
Replace all instances of terminaltables with terminaltables3 in your code. If other libraries depend on terminaltables
in your venv they will not conflict because it is a new namespace.
As of right now, the documentation as the robpol86 version.
📖 Full documentation: https://robpol86.github.io/terminaltables
Quickstart
Install:
pip install terminaltables3
Usage:
from terminaltables3 import AsciiTable
table_data = [
["Heading1", "Heading2"],
["row1 column1", "row1 column2"],
["row2 column1", "row2 column2"],
["row3 column1", "row3 column2"],
]
table = AsciiTable(table_data)
print
table.table
+--------------+--------------+
| Heading1 | Heading2 |
+--------------+--------------+
| row1 column1 | row1 column2 |
| row2 column1 | row2 column2 |
| row3 column1 | row3 column2 |
+--------------+--------------+
To add a separator between selected rows, enable inner_separators and place
the delimiter in the first cell of a marker row. The optional second cell is a
title for that separator:
table = AsciiTable([["Name"], ["Ada"], ["---", "Group B"], ["Bob"]])
table.inner_separators = True
print(table.table)
The delimiter defaults to "---" and can be changed with
table.inner_separators_delimiter. Existing rows keep their usual meaning until
inner_separators is enabled. Markdown tables continue to render marker rows
as data.
Example Implementations

Source code for examples: