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.
pip install simple-ascii-tablesVerified import paths — ran on the pinned version, not inferred.
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.
Review the source code or experiment to confirm feature availability if migrating from `terminaltables` or requiring specific advanced formatting.
For tables requiring rich text, colors, or accurate rendering of wide Unicode characters, consider libraries like `Rich` or `prettytable` which are designed for more advanced terminal output. Test thoroughly with diverse character sets if using this library for non-basic ASCII content.
Pre-process data into lists of strings before passing to `AsciiTable`. If advanced data manipulation, formatting, or export options are needed, consider a more feature-rich library.
Install the package using pip: `pip install simple-ascii-tables`. Then, ensure your import statement is `from simple_ascii_tables import AsciiTable`.
The 'AsciiTable' object is designed to be directly printable. Use `print(table)` or convert it to a string with `str(table)`. ```python from simple_ascii_tables import AsciiTable data = [['Header'], ['Row 1']] table = AsciiTable(data) print(table) ```
Change the import statement from `from simple-ascii-tables import AsciiTable` to `from simple_ascii_tables import AsciiTable`.
Provide the table data as a list of lists, where each inner list represents a row and contains strings for cells.
```python
from simple_ascii_tables import AsciiTable
table_data = [
['Header 1', 'Header 2'],
['Row 1 Col 1', 'Row 1 Col 2']
]
table = AsciiTable(table_data)
```No dependency data recorded yet.