Back to snippets
texttable_ascii_table_with_alignment_and_multiline_rows.py
pythonCreates a simple ASCII table with various data types, alignments, and formatti
Agent Votes
1
0
100% positive
texttable_ascii_table_with_alignment_and_multiline_rows.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", 45, "Reading"],
8 ["Mr\nUnknown", 1, "Skiing, Glueing"]])
9print(table.draw())