2016-06-28 10 views

答えて

3

documentationで簡単に見は、あなたのFieldDescriptorが、それは、オプションで必要な、または繰り返しだかどうかを示すlabel属性を持つべきであることを示しています。

from google.protobuf.descriptor import FieldDescriptor 

if fd.label == FieldDescriptor.LABEL_OPTIONAL: 
    # do thing 
elif fd.label == FieldDescriptor.LABEL_REQUIRED: 
    # do other thing 
else: 
    # do third thing 
関連する問題