2025-02-12 13:07:05 +01:00
|
|
|
# What is it
|
|
|
|
|
|
|
|
Easily draw tables in terminal/console applications from a list of lists of strings. Supports multi-line rows.
|
|
|
|
|
2025-02-12 15:00:49 +01:00
|
|
|
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.
|
2025-02-12 13:07:05 +01:00
|
|
|
|
|
|
|
📖 Full documentation: https://robpol86.github.io/terminaltables
|
|
|
|
|
|
|
|
Quickstart
|
|
|
|
==========
|
|
|
|
|
|
|
|
Install:
|
|
|
|
|
|
|
|
```bash
|
2025-02-12 15:00:49 +01:00
|
|
|
pip install terminaltables3
|
2025-02-12 13:07:05 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
Usage:
|
|
|
|
|
|
|
|
```python
|
2025-02-12 15:00:49 +01:00
|
|
|
from terminaltables3 import AsciiTable
|
2025-02-12 13:07:05 +01:00
|
|
|
|
|
|
|
table_data = [
|
2025-02-12 15:00:49 +01:00
|
|
|
["Heading1", "Heading2"],
|
|
|
|
["row1 column1", "row1 column2"],
|
|
|
|
["row2 column1", "row2 column2"],
|
|
|
|
["row3 column1", "row3 column2"],
|
2025-02-12 13:07:05 +01:00
|
|
|
]
|
|
|
|
table = AsciiTable(table_data)
|
|
|
|
print
|
|
|
|
table.table
|
|
|
|
```
|
|
|
|
|
|
|
|
```bash
|
|
|
|
+--------------+--------------+
|
|
|
|
| Heading1 | Heading2 |
|
|
|
|
+--------------+--------------+
|
|
|
|
| row1 column1 | row1 column2 |
|
|
|
|
| row2 column1 | row2 column2 |
|
|
|
|
| row3 column1 | row3 column2 |
|
|
|
|
+--------------+--------------+
|
|
|
|
```
|
|
|
|
|
|
|
|
Example Implementations
|
|
|
|
=======================
|
|
|
|
![Example Scripts Screenshot](https://github.com/matthewdeanmartin/terminaltables/blob/master/docs/examples.png?raw=true)
|
|
|
|
|
|
|
|
Source code for examples:
|
|
|
|
|
|
|
|
- [example1.py](https://github.com/matthewdeanmartin/terminaltables/blob/master/example1.py)
|
|
|
|
- [example2.py](https://github.com/matthewdeanmartin/terminaltables/blob/master/example2.py)
|
|
|
|
- [example3.py](https://github.com/matthewdeanmartin/terminaltables/blob/master/example3.py)
|
|
|
|
|
2025-02-12 15:00:49 +01:00
|
|
|
[Change Log](https://github.com/matthewdeanmartin/terminaltables/blob/master/CHANGELOG.md)
|