+
95
-

python如何解析protobuf二进制数据?

python如何解析protobuf二进制数据?

网友回复

+
15
-

Python可以使用protobuf库来解析protobuf二进制数据。主要步骤如下:

安装protobuf库:

pip install protobuf

新建yourmessage.proto

syntax = "proto3";
message Message{
  string name = 1;
  int32 age = 2;
}
定义protobuf消息的.proto文件,然后编译生成Python代码:

protoc --python_out=. yourmessage.proto

使用生成的Pyth...

点击查看剩余70%

我知道答案,我要回答