Print basic tables in python
Project description
tablat
A simple way to print output in a table
Basic usage
Just create a Table
objecta and pass it a headers list and the data. The number of columns will be calculated from the number of headers.
Code sample
Code
from pathlib import Path
from tablat import Table
folder_path = Path('./')
header = ['FILE_NAME', 'FOLDER', 'FILES_IN']
data = []
for file_path in folder_path.iterdir():
data.append(file_path.name)
if file_path.is_dir():
data.extend(['YES', len([f for f in file_path.iterdir()])])
else:
data.extend(['NO', 0])
my_table = Table(data, header)
my_table.print_table()
Output
Notes
You can retrieve data form the table using indices
# Get first row data
my_table[0]
# Get third row, second column
my_table[2][1]
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
tablat-0.1.0.tar.gz
(2.3 kB
view hashes)
Built Distribution
tablat-0.1.0-py3-none-any.whl
(3.5 kB
view hashes)