Console Creator
A Python lib that makes creating tables easier than ever !
This lib enables you to create tables, and manipulate them from their columns and rows, instead of having to deal with the usual troubles of this process.
Install
Install from PyPI
To install this library, just type pip install python-tables-lib and this should be ok.
Visit PyPI for more info.
Install from source
Just download the file at this link, and import it in your project.
Usage
See examples if wanted.
This library provides the Table class, which is the table you are going to use.
Table init
This class has two optional parameters on creation :
name: A string containing the name of the table.size: he size of the table. If not filled, the table will be flexible. Otherwise, the table will only fit this size. This should be a tuple of (rows, columns).
The add_row, add_rows, add_column, and add_columns methods
These methods will add rows or columns to the table.
They are disabled if the table size is fixed.
The add_row and add_column methods will take as argument a list or tuple, and will add all its elements to the table.
The add_rows and add_columns methods will take as argument a list/tuple of lists/tuples and will add all its elements to the table.
The delete_row and delete_column methods
The names are pretty explicit : The functions deletes the row/column of the given index
The return_row and return_column methods
These methods will return as list of lists the rows/columns of the table.
Example :
from tables import *
# Table creation
table = Table()
table.add_row([0, 1, 2])
table.add_row([0, 5, 0])
print(table.return_rows())
print(table.return_columns())
Outputs the following :
[[0, 1, 2], [0, 5, 0]]
[[0, 0], [1, 5], [2, 0]]
The render_table function
This method prints a stylized view of the table in the console.
Optional argument :
row_numbers_enabled: Boolean indicating whether or not to display the number of rows.Trueby default.
Example :
from tables import *
# Table creation
table = Table("Testing table")
table.add_row([0, 1, 2])
table.add_row([0, 5, 0])
# Stylized table print
table.render_table()
Outputs the following :
--- Testing table ---
0 -> | 0 | 1 | 2 |
1 -> | 0 | 5 | 0 |
The set_element method
This method sets the value of an element.
Arguments :
row: The row number.column: The column number.value: The value to insert in this cell.name: The name of the cell (optional).
See the example at this link, with a Morpion game.
Release files for python-tables-lib 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| python_tables_lib-1.0.0.tar.gz | 16.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| python_tables_lib-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 33.0 kB
Release files / python_tables_lib-1.0.0.tar.gz
| Download URL | python_tables_lib-1.0.0.tar.gz |
|---|---|
| Size | 16.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
55298cc594a6b80156774753ed30fc4fb2fbe2162fd2962552b120a74e5fa47b
|
|
BLAKE2b-256 checksum How to use checksums |
b5cf4dc00e87b291879666c699ff122f47d7aad95c80d821e11b82776af4c445
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
|
Release files / python_tables_lib-1.0.0-py3-none-any.whl
| Download URL | python_tables_lib-1.0.0-py3-none-any.whl |
|---|---|
| Size | 16.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
54cad15b279d05996ab55ee06c129af0cf05d67f41b46eb99b09a1496296e298
|
|
BLAKE2b-256 checksum How to use checksums |
01cdbf016e30593bc566966cd39209a9b1a1b93ea7131eb6bd6eacadc1f77940
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
|