相关疑难解决方法(0)

将字典打印到表格中

我有一本字典:

dic={'Tim':3, 'Kate':2}
Run Code Online (Sandbox Code Playgroud)

我想将其输出为:

Name Age
Tim 3
Kate 2
Run Code Online (Sandbox Code Playgroud)

首先将它们转换成词典列表的好方法

lst = [{'Name':'Tim', 'Age':3}, {'Name':'Kate', 'Age':2}]
Run Code Online (Sandbox Code Playgroud)

然后通过/sf/answers/726128791/中的方法将它们写入表中?

还是在某种意义上有更好的方法?

python dictionary python-2.7

4
推荐指数
2
解决办法
2万
查看次数

标签 统计

dictionary ×1

python ×1

python-2.7 ×1