0

I have some example code for PrettyTable module but I was wondering if there was a way to center the table in the middle of the terminal.

Code:

from prettytable import PrettyTable

# Create a new table with column names "City" and "Country"
table = PrettyTable(["City", "Country"])

# Add a row with data
table.add_row(["Paris", "France"])

# Add a column with data
table.add_column("Population", [2_141_000])

# Add another row with data
table.add_row(["Berlin", "Germany", 3_769_000])

# Print the table
print(table)

0 Answers0