每次添加一行
from prettytable import PrettyTable
# 默认表头:Field 1、Field 2...
# 添加表头
table = PrettyTable(["URL", "参数", "值"])
# add_row 添加一行数据
table.add_row(["http://aaa.com", "raskv", "dEBxcS5j"])
table.add_row(["http://bbb.com", "su", "626d5633583231794c6d4e6"])
table.add_row(["http://ccc.com", "pwd", "Ym1WM1gyMXlMbU5"])
# 默认居中对齐
# 设置"值"列,局左对齐 left首字母
table.align["值"] = 'l'
print(table)
每次添加一列
from prettytable import PrettyTable
table = PrettyTable()
# add_column 添加一列数据
table.add_column('===', ["URL", "参数", "值"])
table.add_column('第1列', ["http://aaa.com", "raskv", "dEBxcS5j"])
table.add_column('第2列', ["http://bbb.com", "su", "626d5633583231794c6d4e6"])
table.add_column('第3列', ["http://ccc.com", "pwd", "Ym1WM1gyMXlMbU5"])
# 设置"第3列",局右对齐 right首字母
tab