A simple Python CLI table library with no extra dependencies.
Project description
1.You need to make an instance by doing it like this:
python your_table_name = mktable.Table()
and you can have arguements like :
python your_table_name = mktable.Table(["first", "row"], ["Other", "Rows(Optional)"])
2.How to add rows?
python your_table.add_row(["ABC","DEF"], ["Your", "Content"])
just include any row you want how many you want.
3.How to render and Use?
use the render function
like
python table_list = your_table.render()
or you can add arguements such as custom separators like this
python render(self, h_sep_char = '-',v_sep_char ='|', connection_point = '+')
and btw it returns a list you can str(your_table)
to get the printable str
or if you want to print it just do print(your_table)
it automaticaly casts it to str.
Argurments:
connection point : the point where separators connect.
default: table.connection_point = "+"
v_sep_char : vertical separator character
default: table.v_sep_char = "|"
h_sep_char : vertical separator character
default: table.h_sep_char = "-"
4.How to remove rows?
call the function
python table.remove_row(*index)
like
python table.remove_row(1, 5, 10)
make sure you have that amount of rows or you will get index out of range error
5.How to use dictionaries?
for importing from dict:
python my_table.import_dict(my_dict, 'insert', index) #replace my_table with your table and my dict with your dictionary and replace index with an index(int) #index in default is 0 and only matters in 'index' method
method can be either 'insert', 'append' or 'overwrite'.method must be string.
and the method string is not case-sensetive
methods:
overwrite: overwrites all the rows in the table
insert: inserts the dict from given index (0 if non given)
append: appends the dict to the end of the table
for exporting to a dict:
use this method:
python my_table.export_dict() #returns a dict
for assigning it to a new dict (if the variable already exists it will be overwritten):
python my_dict = my_table.export_dict()
and for adding it to a dict:
python my_dict += my_table.export_dict()
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 mktable-0.1.0.tar.gz.
File metadata
- Download URL: mktable-0.1.0.tar.gz
- Upload date:
- Size: 8.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.32.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
90dc5340c01276ac5dd0d4a5453a5054dedcb5e9d1905d28e68e92a58354ae81
|
|
| MD5 |
843c87c1618fda94b702a0c6c1c75837
|
|
| BLAKE2b-256 |
f63b083b61b50144204b90945a18eff6f324efec062722271298e0ea2ea73123
|
File details
Details for the file mktable-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mktable-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.32.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
31e73b4e48446a7d6d3c739fc9b63222162b585bc01d52778aed25ee03574127
|
|
| MD5 |
39094ae58df5c1bafeeee01e141e745b
|
|
| BLAKE2b-256 |
d57c81a3f4048a330b820166f88f1e03a393654d67587c80e72320f8734484f9
|