您可以为此使用python的制表库。
例如:
>>> from tabulate import tabulate>>> value_list = [['Alex', 13,1, 'Chess', 10], ['Zia', 12,2, 'Monopoly', 25]]>>> column_list = ["Name", "Age", "Number of Games", "Favourite Game", "Cost of Game"]>>> print tabulate(value_list, column_list, tablefmt="grid")+--------+-------+-------------------+------------------+----------------+| Name | Age | Number of Games | Favourite Game | Cost of Game |+========+=======+===================+==================+================+| Alex | 13 | 1 | Chess | 10 |+--------+-------+-------------------+------------------+----------------+| Zia | 12 | 2 | Monopoly | 25 |+--------+-------+-------------------+------------------+----------------+



