Skip to main content

Convert 2D Python lists into Unicode/Ascii tables

Project description

table2ascii

Module for converting 2D Python lists to a fancy ASCII/Unicode tables

๐Ÿ“ฅ Installation

pip install table2ascii

๐Ÿง‘โ€๐Ÿ’ป Usage

Convert Python lists to ASCII tables

from table2ascii import table2ascii

output = table2ascii(
    header=["#", "G", "H", "R", "S"],
    body=[["1", "30", "40", "35", "30"], ["2", "30", "40", "35", "30"]],
    footer=["SUM", "130", "140", "135", "130"],
)

print(output)

"""
โ•”โ•โ•โ•โ•โ•โ•ฆโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘  #  โ•‘  G     H     R     S  โ•‘
โ•Ÿโ”€โ”€โ”€โ”€โ”€โ•ซโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ข
โ•‘  1  โ•‘  30    40    35    30 โ•‘
โ•‘  2  โ•‘  30    40    35    30 โ•‘
โ•Ÿโ”€โ”€โ”€โ”€โ”€โ•ซโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ข
โ•‘ SUM โ•‘ 130   140   135   130 โ•‘
โ•šโ•โ•โ•โ•โ•โ•ฉโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
"""
from table2ascii import table2ascii

output = table2ascii(
    body=[["1", "30", "40", "35", "30"], ["2", "30", "40", "35", "30"]]
)

print(output)

"""
โ•”โ•โ•โ•โ•โ•โ•ฆโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘  1  โ•‘  30    40    35    30 โ•‘
โ•‘  2  โ•‘  30    40    35    30 โ•‘
โ•šโ•โ•โ•โ•โ•โ•ฉโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
"""

โš™๏ธ Options

Soon table2ascii will support more options for customization.

๐Ÿงฐ Development

To run tests (pytest)

python setup.py test

To lint (flake8):

python setup.py lint

Project details


Download files

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

Source Distribution

table2ascii-0.0.1.tar.gz (4.9 kB view hashes)

Uploaded Source

Built Distribution

table2ascii-0.0.1-py3-none-any.whl (5.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page