Skip to content

Instantly share code, notes, and snippets.

View brokeDude2901's full-sized avatar
🪐
Oh, what a day... what a lovely day!

brokeDude2901

🪐
Oh, what a day... what a lovely day!
View GitHub Profile
@brokeDude2901
brokeDude2901 / tabulate-tables-side-by-side
Created April 5, 2023 14:33 — forked from edisongustavo/tabulate-tables-side-by-side
Prints tables generated with python-tabulate side by side
from tabulate import tabulate
def print_tables_side_by_side(*tables, spacing: int = 3):
string_tables_split = [tabulate(t, headers="firstrow").splitlines() for t in tables]
spacing_str = " " * spacing
num_lines = max(map(len, string_tables_split))
paddings = [max(map(len, s_lines)) for s_lines in string_tables_split]