Python 将二进制文件转换为原始文件
服务器返回给我二进制文件- 我想找到二进制文件的.proto结构 因此,我将该文件添加到该站点- 收到 我创建了proto文件,但没有收到有效文本 我应该在我的原型结构中改变什么 更新1 我曾经Python 将二进制文件转换为原始文件,python,protocol-buffers,google-protocol-buffer,Python,Protocol Buffers,Google Protocol Buffer,服务器返回给我二进制文件- 我想找到二进制文件的.proto结构 因此,我将该文件添加到该站点- 收到 我创建了proto文件,但没有收到有效文本 我应该在我的原型结构中改变什么 更新1 我曾经 如果您无法获得模式,那么这主要是基于试错的。但是,我可以告诉您,这里的根对象看起来不像一个重复的列表——这是真的 每个子项都有相同的字段号,分别为1和2 每个子项的形状都与其他子项相同,请参见字段4“文本与子对象” 因此,您的根对象有如下内容: 可选的Foo-Foo=1; 可选条=2; 如果您无法获得模
如果您无法获得模式,那么这主要是基于试错的。但是,我可以告诉您,这里的根对象看起来不像一个重复的列表——这是真的 每个子项都有相同的字段号,分别为1和2 每个子项的形状都与其他子项相同,请参见字段4“文本与子对象” 因此,您的根对象有如下内容: 可选的Foo-Foo=1; 可选条=2;
如果您无法获得模式,那么这主要是基于试错的。但是,我可以告诉您,这里的根对象看起来不像一个重复的列表——这是真的 每个子项都有相同的字段号,分别为1和2 每个子项的形状都与其他子项相同,请参见字段4“文本与子对象” 因此,您的根对象有如下内容: 可选的Foo-Foo=1; 可选条=2;
如果这是过时的,很抱歉,但是如果您查看该页面上运行的js,会发现一些用于解码这些对象的代码: t、 id&&t.hasOwnPropertyid&&e.uint3210.bytest.id, 空!=t、 description和&t.hasownproperty说明和&e.uint3218.stringt.description, 空!=t、 imageUrl&&t.hasOwnPropertyimageUrl&&e.uint3226.stringt.imageUrl, 空!=t、 priceOld&t.HasownProperty priceOld&e.uint3237.Float.priceOld, 空!=t、 priceNew和&t.hasOwnPropertypriceNew和&e.uint3245.Float.priceNew, 空!=t、 priceIsFrom&&t.hasOwnPropertypriceIsFrom&&e.uint3248.boolt.priceIsFrom, t、 segmentId&&t.hasOwnPropertysegmentId&&e.uint3258.bytest.segmentId, 空!=t、 数量和t.HasownProperty数量和e.uint3269.Float.quantity, 空!=t、 quantityUnit和&t.hasOwnPropertyquantityUnit和&e.uint3274.stringt.quantityUnit, 空!=t、 折扣和&t.hasOwnPropertydiscount和&e.uint3285.float.discount, 空!=t、 折扣单位和&t.hasOwnPropertydiscountUnit和&e.uint3290.stringt.discountUnit, 空!=t、 折扣标签和&t.hasOwnPropertydiscountLabel和&e.uint3298.stringt.discountLabel, 空!=t、 折扣百分比和&t.HasownProperty折扣百分比和&e.uint32104.uint32t.discountPercent, 空!=t、 国家和t.HasownProperty国家和e.uint32114.stringt.country, 空!=t、 dateStart&&t.hasOwnPropertydateStart&&e.uint32122.stringt.dateStart, 空!=t、 dateEnd和&t.hasOwnPropertydateEnd和&e.uint32130.stringt.dateEnd, t、 metaId和&t.hasOwnPropertymetaId和&e.uint32138.bytest.metaId, t、 compileids&&t.compileids.length 对于var r=0;r
syntax = "proto2";
message Cities {
repeated City city = 1;
}
message City {
optional string name = 2;
optional string name2 = 3;
optional string name3 = 4;
optional string name4 = 5;
optional string name5 = 6;
optional string name6 = 7;
optional int32 name7 = 8;
optional int32 name8 = 9;
optional int32 name9 = 10;
optional string name10 = 11;
}
protoc --decode_raw < binary_file.protobuf
1 {
1: "U\222\017\352c\021\021\346\204\237RT\000\020\266\010"
2: "\320\241\320\260\320\275\320\272\321\202-\320\237\320\265\321\202\320\265\321\200\320\261\321\203\321\200\320\263"
4 {
1: 0x426fc1a3
2: 0x41f286ea
}
5: "\320\241\320\260\320\275\320\272\321\202-\320\237\320\265\321\202\320\265\321\200\320\261\321\203\321\200\320\263"
5: "\320\241\320\260\320\275\320\272\321\202-\320\237\320\265\321\202\320\265\321\200\320\261\321\203\321\200\320\263\320\260"
5: "\320\241\320\260\320\275\320\272\321\202-\320\237\320\265\321\202\320\265\321\200\320\261\321\203\321\200\320\263\321\203"
5: "\320\241\320\260\320\275\320\272\321\202-\320\237\320\265\321\202\320\265\321\200\320\261\321\203\321\200\320\263"
5: "\320\241\320\260\320\275\320\272\321\202-\320\237\320\265\321\202\320\265\321\200\320\261\321\203\321\200\320\263\320\276\320\274"
5: "\320\241\320\260\320\275\320\272\321\202-\320\237\320\265\321\202\320\265\321\200\320\261\321\203\321\200\320\263\320\265"
5: "\320\241\320\260\320\275\320\272\321\202-\320\237\320\265\321\202\320\265\321\200\320\261\321\203\321\200\320\263\320\265"
6: "sankt-peterburg"
7: 2
}
2 {
1: "\224\331\203\202B\303\021\346\224\031RT\000\020\266\010"
2: "\260\336\t\360I\026I\006\217\232t\2021T\030B"
3: "\320\237\321\217\321\202\321\221\321\200\320\276\321\207\320\272\320\260"
4: "https://leonardo.edadeal.io/dyn/re/retailers/images/icons/sq/85cd6908f8a34aefbe66dd1948cc3d39.png"
5: "https://leonardo.edadeal.io/dyn/re/retailers/images/logos/sq/992af68cffaa47de9ff23079648074ad.png"
6: "eb2316"
7: 733
8: 55
9: 425
10: "5ka"
}
2 {
1: "\224\331\205\336B\303\021\346\224\031RT\000\020\266\010"
2: "\260\336\t\360I\026I\006\217\232t\2021T\030B"
3: "\320\224\320\270\320\272\321\201\320\270"
4: "https://leonardo.edadeal.io/dyn/re/retailers/images/icons/sq/146db05ebc81464cbf4872675cb2e761.png"
5: "https://leonardo.edadeal.io/dyn/re/retailers/images/logos/sq/9c2b2c291f134929949fa4daab88252f.png"
6: "FF8A38"
7: 691
8: 61
9: 276
10: "dixy"
}