Simple ASCII Tables

1.0.1 · active · verified Tue Apr 14

A simple, minimal, and dependency-free Python package for generating ASCII tables. It is a simplified fork of the unmaintained `terminaltables` library, focusing on basic usage without the complexity or external dependencies of other table formatting solutions. The current version is 1.0.1, released on January 23, 2025.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to create a basic ASCII table using `AsciiTable`. Provide your data as a list of lists of strings. The outer list represents the table, and each inner list represents a row. The first inner list typically serves as the header. You can optionally set a title and customize various border elements.

from simple_ascii_tables import AsciiTable

table_data = [
    ['Heading 1', 'Heading 2', 'Heading 3'],
    ['Row 1, Col 1', 'Row 1, Col 2', 'Row 1, Col 3'],
    ['Row 2, Col 1', 'Row 2, Col 2', 'Row 2, Col 3 that is very long and wraps'],
    ['Short', 'Medium Text', 'Longer Text Here']
]

table = AsciiTable(table_data)
# Optional: Set a title
table.title = "My Simple Table"

# Optional: Customize borders (inherits from terminaltables)
# table.inner_column_border = False
# table.outer_border = False

print(table.table)

view raw JSON →