【发布时间】:2022-07-08 04:25:26
【问题描述】:
protobuf:
消息测试 {
int16 a:1
message `testdata`{
int16 b:1 `
int16 c:2
repeated `testdata` `test_data`
}
}
dt=test()
dt.a=11
dt1=d.testdata.add()
dt1.b=2222
dt1.c=3333
发送=dt.SerializeToString()
现在反序列化代码如下:
t=test()
t.ParseFromString(send)
t1=t.testdata()
print(t1.test_data)----> empty string
print(t1.b)--> value is not printing as expected, its printing object name instead of value.
how to access the nested protobuf elements and any input or suggestions are welcome.
【问题讨论】:
标签: protocol-buffers