Python ile terminal üzerinde tablo gösterme

python, table, tabulate

pip install tabulate

Here's a basic example of how to use the tabulate package:

from tabulate import tabulate

data = [
    ["Alice", 30, "New York"],
    ["Bob", 25, "San Francisco"],
    ["Charlie", 22, "Los Angeles"],
]

headers = ["Name", "Age", "City"]

print(tabulate(data, headers=headers, tablefmt="grid"))

This will output:

+----------+-----+--------------+
| Name     | Age | City         |
+----------+-----+--------------+
| Alice    |  30 | New York     |
+----------+-----+--------------+
| Bob      |  25 | San Francisco|
+----------+-----+--------------+
| Charlie  |  22 | Los Angeles  |
+----------+-----+--------------+

Last updated

© 2024 ~ Yunus Emre Ak ~ yEmreAk