代码:
from prettytable import PrettyTable
field_names = ("ID",'名字','英语成绩','Python成绩','C语言成绩')
table = PrettyTable(field_names=field_names)
table.add_row(['05','nigar',99,80,60])
print(table)
输出结果:
+----+-------+----------+------------+-----------+
| ID | 名字 | 英语成绩 | Python成绩 | C语言成绩 |
+----+-------+----------+------------+-----------+
| 05 | nigar | 99 | 80 | 60 |
+----+-------+----------+------------+-----------+