美文网首页
python字典数据输出为整齐的表格

python字典数据输出为整齐的表格

作者: chenxuan | 来源:发表于2022-01-11 14:02 被阅读0次

参考链接

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

相关文章

网友评论

      本文标题:python字典数据输出为整齐的表格

      本文链接:https://www.haomeiwen.com/subject/tnvbcrtx.html