python3使用tabulate漂亮的打印数据

需要先安装 tabulate 模块:

pip3 install tabulate

以上是把一维的dict打印出来.

再看看二维的,list-of-dict

(注:此处project函数是funcy包中的一个功能)

output:

漂亮!

(另外, 之前也用过 PrettyTable ,但是感觉没有tabulate简单上手)

猜你喜欢

转载自www.cnblogs.com/nica/p/10868662.html