python字典数据输出为整齐的表格
2022-01-11 本文已影响0人
chenxuan
from tabulate import tabulate
Dict = {'name':'name','age':'age'}
KEY = list(Dict.keys())
VALUE = list(Dict.values())
VALUE = [str(x) for x in VALUE]
showdata = []
showdata.append(VALUE)
print(tabulate(showdata, headers=KEY, tablefmt='pipe', disable_numparse=True))
