matthewdeanmartin / terminaltables

Generate simple tables in terminals from a nested list of strings.

Home Page:https://robpol86.github.io/terminaltables

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

terminaltables

What is it

Easily draw tables in terminal/console applications from a list of lists of strings. Supports multi-line rows.

  • Python 2.6, 2.7, PyPy, PyPy3, 3.3, 3.4, and 3.5+ supported on Linux and OS X.
  • Python 2.7, 3.3, 3.4, and 3.5+ supported on Windows (both 32 and 64 bit versions of Python).

đź“– Full documentation: https://robpol86.github.io/terminaltables

Quickstart

Install:

pip install terminaltables

Usage:

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 |
+--------------+--------------+

Example Implementations

Example Scripts Screenshot

Source code for examples:

Change Log

About

Generate simple tables in terminals from a nested list of strings.

https://robpol86.github.io/terminaltables

License:MIT License


Languages

Language:Python 98.2%Language:Makefile 1.5%Language:Shell 0.3%