Protobuf, Python: assign to a field

I am trying to modify values in a protobuf binary file with Python. I iterate over the fields in the message and set them to new values, however, when I check the values in the message object, I see that the values are still the same, which leads me to the conclusion that the fields are copied during the iteration.

Is there a way to modify fields in a protobuf message without creating a new object and assembling it from modified values?

UPD : I am working with a parsed binary file, that is I import my generated python file (generated from the .proto file), ParseFromString it, and then I work with the deserialized representation of that.

链接地址: http://www.djcxy.com/p/77288.html

上一篇: Python:打印protobuf规范(字段,类型)

下一篇: Protobuf,Python:分配给一个字段