Skip to main content

No project description provided

Project description

tabuletta

Installation

Installing this library is super easy!

    pip install tabuletta

Intro

Tbuletta is a python library that print's arrays in a tabular form with some customisation.

Example

This library is extremly simple, to use it make a list of lists, each inner list should be a row. The amount of elements in each inner list needs to be uniform.

For example,

table = [
    [5, 2, 3.5],
    [4.1, 900, 2],
    ["Sup", 5, 1]
]

Will print:

+-----------------+
| 5   | 2   | 3.5 |
| 4.1 | 900 | 2   |
| Sup | 5   | 1   |
+-----------------+

It can also print:

+-----------------+
| 5   | 2   | 3.5 |
+-----+-----+-----+
| 4.1 | 900 | 2   |
| Sup | 5   | 1   |
+-----------------+

It's all your choice.

Using tabuletta

To use tabuletta, simply import tabuletta after following the installation instructions from above

import tabuletta

Then, create the list you would like to print

myList = [
    ["Reg no", "Email"],
    ["20ABC1000", "John@fakeemail.com"],
    ["21BCD0001", "Wick@fakeemail.com"]
]

Then simply print it! Choose whether or not you would like field names (use True if so, don't put anything if not (don't include useFieldNames at all) because it defaults to False).

# NOTE: useFieldNames defaults to False, so, if you don't type useFieldNames=True it automatically goes to False
tabuletta.printTable(myList, useFieldNames=True)

As output, you get:

+-----------------------------------------------+
| Reg no                  | Email              |
+-----------------------+-----------------------+
| 20ABC1000               | John@fakeemail.com |
| 21BCD0001               | Wick@fakeemail.com |
+-----------------------------------------------+

If you didn't want to use field names then you would only have to write:

tabuletta.printTable(myList)

Another example:

myList = [
    ["", "a", "b"],
    ["x", "a + x", "a + b"],
    ["z", "a + z", "z + b"]
]

From that, you get:

+-----------------------+
|       | a     | b     |
+-------+-------+-------+
| x     | a + x | a + b |
| z     | a + z | z + b |
+-----------------------+

Using colors

You might want to use colors in tabuletta.

To use them simply use RGB values, so, using the example from above:

import tabuletta

myList = [
    ["", "a", "b"],
    ["x", "a + x", "a + b"],
    ["z", "a + z", "z + b"]
]

# give the color name
tabuletta.printTable(myList, useFieldNames=True, color="red")

As output you get:

Some more examples of colors:

The available color options are : red, blue, orange, cyan, pink, green, yellow

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

tabuletta-0.2.2.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tabuletta-0.2.2-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file tabuletta-0.2.2.tar.gz.

File metadata

  • Download URL: tabuletta-0.2.2.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for tabuletta-0.2.2.tar.gz
Algorithm Hash digest
SHA256 12a918208a6aa34018925d0080ad635d40fcaa0b55b682cdd03aae14335ac5be
MD5 6b7bb72a851f558880ed725cee8aa141
BLAKE2b-256 46070b73a14df249681b731828daf83ee41fbcc5397f84e1f13f5f40c47f9429

See more details on using hashes here.

File details

Details for the file tabuletta-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: tabuletta-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for tabuletta-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 550066255933b26fcddfe87f619ddef127749f4dabc08ae00d035626517153d0
MD5 b5f62efe143f69b6f1a2a856d5e79ac7
BLAKE2b-256 a5cd69acfba904ec6dbe22497547197ef56c86636ec04ad08b3f810e44765f43

See more details on using hashes here.

Supported by

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