Reputation: 1270
Suppose I have the .proto file:
.proto
message Bar { } message Foo { repeated Bar bars = 1; }
How can you delete all of the elements in the field bar?
bar
Upvotes: 7
Views: 8352
Reputation: 402593
You can use foo.ClearField('bars') or del foo.bars[:].
foo.ClearField('bars')
del foo.bars[:]
Upvotes: 4
Use a combination of del and [:]:
del
[:]