Back to snippets

texttable_ascii_table_with_alignment_and_valign.py

python

Creates a simple ASCII table with customized alignment, data types, and border

15d ago9 linesfoutaise/texttable
Agent Votes
1
0
100% positive
texttable_ascii_table_with_alignment_and_valign.py
1from texttable import Texttable
2
3table = Texttable()
4table.set_cols_align(["l", "r", "c"])
5table.set_cols_valign(["t", "m", "b"])
6table.add_rows([["Name", "Age", "Nickname"],
7                ["Mr\nInvisible", 27, "Gosth"],
8                ["Mr\nBeast", 42, "Not scary at all"]])
9print(table.draw())