Python中对table(表格)的应用

Python中对table(表格)的应用

代码:

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    |
+----+-------+----------+------------+-----------+

你可能感兴趣的:(Python,运维)