来源:https://github.com/bufordtaylor/python-texttable
from texttable import Texttable
table = Texttable()
table.set_deco(Texttable.BORDER)
table.set_cols_align(["l", "l", "l"])#require three columns
table.set_cols_valign(["m", "m", "m"])
#table.set_chars(["","","",""])
table.set_cols_width([10,5,10])
table.add_rows([ #["Name", "Age", "Nickname"],
#["Mr\nXavier\nHuon", 32, "Xav'"],
#["Mr\nBaptiste\nClement", 1, "Baby"] ,
["Tom",32,"cat"],
["ancj",9,"hjasdg"],
["asdhjaskhd",109,"nash"] ])
print(table.draw() + "\n")