How to assign to repeated field?

后端 未结 4 1028
猫巷女王i
猫巷女王i 2021-01-30 15:36

I am using protocol buffers in python and I have a Person message

repeated uint64 id

but when I try to assign a value to it like:<

4条回答
  •  广开言路
    2021-01-30 16:06

    As per the documentation, you aren't able to directly assign to a repeated field. In this case, you can call extend to add all of the elements in the list to the field.

    person.id.extend([1, 32, 43432])
    

提交回复
热议问题