Warning: This document is for the development version of terminaltables. The latest version is v3.1.0.

terminaltables 3.1.0

Easily draw tables in terminal/console applications from a list of lists of strings. As easy as:

>>> from terminaltables import AsciiTable
>>> table_data = [
... ['Heading1', 'Heading2'],
... ['row1 column1', 'row1 column2'],
... ['row2 column1', 'row2 column2'],
... ['row3 column1', 'row3 column2'],
... ]
>>> table = AsciiTable(table_data)
>>> print table.table
+--------------+--------------+
| Heading1     | Heading2     |
+--------------+--------------+
| row1 column1 | row1 column2 |
| row2 column1 | row2 column2 |
| row3 column1 | row3 column2 |
+--------------+--------------+
_images/examples.png

Windows 10, Windows XP, and OS X are also supported. View source: example1.py, example2.py, example3.py

Features

  • Multi-line rows: add newlines to table cells and terminatables will handle the rest.
  • Table titles: show a title embedded in the top border of the table.
  • POSIX: Python 2.6, 2.7, PyPy, PyPy3, 3.3, 3.4, and 3.5 supported on Linux and OS X.
  • Windows: Python 2.7, 3.3, 3.4, and 3.5 supported on Windows XP through 10.
  • CJK: Wide Chinese/Japanese/Korean characters displayed correctly.
  • RTL: Arabic and Hebrew characters aligned correctly.
  • Alignment/Justification: Align individual columns left, center, or right.
  • Colored text: colorclass, colorama, termcolor, or just plain ANSI escape codes.