A Python lib that makes creating tables easier than ever !
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file python_tables_lib-1.0.0.tar.gz.
File metadata
- Download URL: python_tables_lib-1.0.0.tar.gz
- Upload date:
- Size: 16.3 kB
- Tags: Source
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
55298cc594a6b80156774753ed30fc4fb2fbe2162fd2962552b120a74e5fa47b
|
|
| MD5 |
c7b4d263a92b3ba750242b07a09b29d5
|
|
| BLAKE2b-256 |
b5cf4dc00e87b291879666c699ff122f47d7aad95c80d821e11b82776af4c445
|
File details
Details for the file python_tables_lib-1.0.0-py3-none-any.whl.
File metadata
- Download URL: python_tables_lib-1.0.0-py3-none-any.whl
- Upload date:
- Size: 16.7 kB
- Tags: Python 3
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
54cad15b279d05996ab55ee06c129af0cf05d67f41b46eb99b09a1496296e298
|
|
| MD5 |
5c7106bf464439e2ce7efa193dbc66a0
|
|
| BLAKE2b-256 |
01cdbf016e30593bc566966cd39209a9b1a1b93ea7131eb6bd6eacadc1f77940
|