curses
ncurses
prettytable
from prettytable import PrettyTable row = PrettyTable() row.field_names = ["Name", "Age", "Country", "City"] # 增加表头 row.add_row(['shaw', '23', 'China', 'Shanghai']) # 增加行数据 row.add_row(['charle', '29', 'China', 'Xuzhou']) row.add_row(['jack', '32', 'United States', 'Washington']) print(row) # 结果: # +--------+-----+---------------+------------+ # | Name | Age | Country | City | # +--------+-----+---------------+------------+ # | shaw | 23 | China | Shanghai | # | charle | 29 | China | Xuzhou | # | jack | 32 | United States | Washington | # +--------+-----+---------------+------------+