If I have an instance of a protobuf, is there a way to get the package name from that instance? the docs indicate that
The Python code generated by the protocol buffer compiler is completely unaffected by the package name defined in the .proto file.
Does that mean that there isn't a way to get the package name from a python protobuf instance?
答案 0 :(得分:1)
如果我有一个protobuf对象response
print type(response)
打印
<class 'weather_pb2.WeatherReply'>
和
print response.DESCRIPTOR.full_name
打印
weather.WeatherReply
weather
是指定WeatherReply的包名称。