我有嵌套的字典,我想从中创建一个 CSV 文件。 CSV 中的表格只需要包含特定字段。我的字典看起来像这样:
rows = { 'signature1': { 'element': 'element1', 'process': 'process1', 'process_stack' : 'foo()\n callfoo()\nhelper_function()\ninitialize()\n', 'file_name' : 'file_1.txt'},
'signature2': { 'element': 'element2', 'process': 'process2', 'process_stack' : 'foo2()\n callfoo2()\nhelper_function()\ninitialize()\n', 'file_name' : 'file_2.txt'},
'signature3': {'element': 'element3', 'process': 'process3','process_stack': 'foo3()\n callfoo3()\nhelper_function()\ninitialize()\n','file_name': 'file_3.txt'}}```
我需要我的 CSV 将字段设置为
process signature filename
process1 signature1 file_1.txt
process2 signature2 file_2.txt
process3 signature3 file_3.txt