terminaltables3

raw JSON →
4.0.0 verified Mon Apr 27 auth: no python

A Python library for generating simple ASCII and Unicode tables in terminals from a nested list of strings. Fork of terminaltables with Python 3.8+ support and modernised APIs. Version 4.0.0 released 2023.

pip install terminaltables3
error ModuleNotFoundError: No module named 'terminaltables3'
cause Trying to import from 'terminaltables3' instead of 'terminaltables'.
fix
Change import to 'from terminaltables import ...'
error AttributeError: module 'terminaltables' has no attribute 'AsciiTable'
cause Installed the original terminaltables instead of terminaltables3.
fix
Uninstall original: pip uninstall terminaltables, then install terminaltables3.
error TypeError: __init__() got an unexpected keyword argument 'title'
cause Using 'title' parameter with terminaltables3 4.0.0 where it's deprecated/removed.
fix
Remove the title argument or upgrade to latest version if re-added.
gotcha Import from 'terminaltables' not 'terminaltables3'. The module name is unchanged.
fix Use 'from terminaltables import ...'
breaking Removed support for Python < 3.8. If upgrading from original terminaltables, check Python version.
fix Ensure Python 3.8+ or use older terminaltables for 2.7/3.5.
deprecated The 'title' parameter in AsciiTable and other table classes is deprecated and may be removed in future versions.
fix Do not rely on the title parameter; use separate print statements.

Create a simple ASCII table from a list of lists.

from terminaltables import AsciiTable
table_data = [
    ['Name', 'Age', 'City'],
    ['Alice', '30', 'New York'],
    ['Bob', '25', 'Los Angeles'],
]
table = AsciiTable(table_data)
print(table.table)