Skip to main content

Print headers and rows of data in terminal

Project description

CircleCI

Python Table

Print out headers and rows in to a table in the terminal.

Install

Run pip install terminal_table to install the package.

Usage

Pass in a two dimensional list or tuple of data for the table rows and a list or tuple for the headers.

from terminal_table import Table

print(Table.create(((1, 2, 3), (5, 6, 7)), ('a', 'b', 'c')))

You can optionally pass in some text colours for the header rows and columns with AnsiColours

https://github.com/sarcoma/Python_ANSI_Colours

    from terminal_table import Table
    from ansi_colours import AnsiColours as Colour

    table = Table.create(
        (
            (1, "Johnathon", "Pollitt", "Seres"),
            (2, "Nerita", "Beetham", "Guanshan"),
            [3, "Celia", "Cawsby", "Łaskarzew"],
            [4, "Carolin", "Muggleston", "Beishan"],
            (5, "Homere", "Caird", "Shuangzhu"),
            (6, "Conrado", "Wethey", "Yezhi"),
            (7, "Winifred", "Malloch", "Orekhovo - Borisovo Severnoye"),
            (8, "Ag", "Wardley", "Buenos Aires"),
            (9, "Shelby", "Janiak", "Skänninge"),
            (10, "Sully", "McIlmurray", "Huxiaoqiao")
        ),
        ("ID", "First Name", "Last Name", "City"),
        header_colour=Colour.cyan,
        column_colours=(Colour.green,)
    )
    print(table)

Screenshot of Pagination

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for terminal-table, version 1.0.8
Filename, size File type Python version Upload date Hashes
Filename, size terminal_table-1.0.8-py2.py3-none-any.whl (5.0 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size terminal_table-1.0.8.tar.gz (6.0 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page