我有一个非常长的python dict,其中有一些键,里面有更多的dict,如下面的示例所示
{
"dscpTagValue": {"data": 10,
"accuracy": Low Drop"}
"description": "Latency Insensitive"
}
,
{
"dscpTagValue": {"data": 10,
"accuracy": Low Drop"}
"description": "Latency Insensitive"
}
{
"dscpTagValue": {"data": 10,
"accuracy": Low Drop"}
"description": "Latency Insensitive"
}
如何将其导出到excel?有些dict中可能包含多个字典,有些dict中可能没有其他dict,只有键和值
我强烈建议您使用
pandas
进行这些数据管理操作。使用字典列表,例如:您可以使用数据框的
to_excel
将其写入excel:考虑到数据是一个字典列表,您可以使用
csv.DictWriter()
并使用最大键指定csv的列名。大概是这样的:相关问题 更多 >
编程相关推荐