我将使用Protobuf进行Python翻译。
我一直在尝试使用默认值,但每次运行SerializeToString()时都没有输出结果。
例如,这是我的.proto文件对象。
message Test{
optional string lol = 1 [default="HI"];
optional int32 num = 2 [default=200];
}
我运行
test = packets_pb2.Test()
print(test.num)
print(test.SerializeToString())
执行print(test.num)可得到200,但执行SerializeToString()没有结果(为空)。
我希望我的默认值被序列化。
您有什么好的方法吗?
先行致谢。
proto2
上完成它? - Paiusco