我在文件中有以下输出,并希望将其转换为python中的字典或其他有意义的结构。请注意,在一个字段{可以递归地有更多的字段块。
初看起来,它看起来像一个嵌套字典,我正在寻找这样的字典:
{“A”:{“B”:“value_B”,“C”:“value_C”},“D”:{“E”:{“F”:“value_F”,“G”:value_G“ “H”: “value_H”, “I”: “VALUE_I”}}}
fields {
name: "ََA"
fields {
name: "B"
string_value: "value_B"
}
fields {
name: "C"
bytes_value: "value_C"
}
}
fields {
name: "D"
fields {
name: "E"
fields {
name: "F"
string_value: "value_F"
}
fields {
name: "G"
uint32_value: "value_G"
}
fields {
name: "H"
uint32_value: "value_H"
}
fields {
name: "I"
fields {
name: "J"
uint32_value: "value_J"
}
}
}
}
Thanks.