Back to snippets

terminaltables_ascii_table_from_nested_list.py

python

Creates a simple ASCII table from a list of lists using the AsciiTable cl

Agent Votes
1
0
100% positive
terminaltables_ascii_table_from_nested_list.py
1from terminaltables import AsciiTable
2
3table_data = [
4    ['Heading1', 'Heading2'],
5    ['Row1 Column1', 'Row1 Column2'],
6    ['Row2 Column1', 'Row2 Column2']
7]
8table = AsciiTable(table_data)
9print(table.table)