如何在python中填充protobuf中的StringValue

2024-05-19 15:05:41 发布

您现在位置:Python中文网/ 问答频道 /正文

如何在protobuf中填充StringValue(python编程)

message event {
    string id = 1; 
    google.protobuf.StringValue test = 2;
}

Tags: testeventidmessagestring编程googleprotobuf
2条回答
event.test.value = 'test'

同样有效。它更简单,不需要导入StringValue类。在

经过一段时间的斗争找到了答案

event.test.CopyFrom(wrappers.StringValue(value='test'))

相关问题 更多 >