I see the function SerializeAsString in the protobuf Python documentation, but like this suggests, this gives me a string version of the binary data. Is there a way of serializing and parsing a binary array of protobuf data using Python?
We have a C++ application that stores the protobuf messages as binary data in a file. We’d like to read and write to the file using Python.
Python 2 (edit: end of life 2020) strings can hold binary data, therefore
SerializeAsStringreturns binary data.Edit: Surfacing from comments: "In Python 3, the
SerializeToStringmethod returns an instance of bytes"