Simple ASCII Tables
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
- gotcha This library is a simplified fork of `terminaltables` and aims for minimalism. It may not support all advanced features found in `terminaltables` (e.g., different border styles like single or double lines using Unicode box-drawing characters, which were available in `SingleTable` or `DoubleTable` in the original library).
- gotcha As a purely ASCII-based table generator, `simple-ascii-tables` may have limited or no robust support for wide Unicode characters (e.g., emojis, CJK characters) or ANSI escape codes for coloring. Such characters often have a display width greater than one, which can cause misalignments in fixed-width ASCII tables.
- gotcha The library is designed to be dependency-free. While beneficial for light-weight applications, this means it explicitly does not include features often found in larger table-generation libraries, such as automatic data type handling, sorting, HTML/JSON output, or complex cell styling. Data should be pre-formatted as strings.
Install
-
pip install simple-ascii-tables
Imports
- AsciiTable
from simple_ascii_tables import AsciiTable
Quickstart
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)