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))
image.png
上一篇 下一篇

猜你喜欢

热点阅读