【发布时间】:2021-05-15 01:34:49
【问题描述】:
希望你能帮我解决这个问题。
我有一个像这样的嵌套字典:
Inventory = {'devicename': {'Interface1': {'port_setting1': 'value', 'port_setting2': 'value'}, 'Interface2': {'port_setting1': 'value', 'port_setting2': 'value'}}}
我想用以下格式创建一个 csv:
devicename, interface1, value of port_setting1, value of portsetting2
devicename, interface2, value of port_setting1, value of portsetting2
你能帮我解决这个问题吗?
谢谢!
【问题讨论】:
-
遍历字典并将行写入csv文件。
标签: python csv dictionary