How to assign to repeated field?

后端 未结 4 1023
猫巷女王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:05

    If you don't want to extend but overwrite it completely, you can do:

    person.id[:] = [1, 32, 43432]
    

    This approach will also work to clear the field entirely:

    del person.id[:]
    

提交回复
热议问题