[英]How to fill StringValue in protobuf in python
如何在protobuf中填充StringValue(python編程)
message event {
string id = 1;
google.protobuf.StringValue test = 2;
}
event.test.value = 'test'
也有效。 它更直接,不需要導入StringValue
類。
折騰了一陣子找到了答案
event.test.CopyFrom(wrappers.StringValue(value='test'))
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.