S M
2017-04-04 21:34:17 UTC
I'm working on python protobuf and I need to convert a protobuf object to
bytes. I know in Java, it can be done using toByteArray() method: byte[]
toByteArray(): serializes the message and returns a byte array containing
its raw bytes.
In Python there is SerializeToString() method: SerializeToString():
serializes the message and returns it as a string. Note that the bytes are
binary, not text; we only use the str type as a convenient container.
Found here:
https://developers.google.com/protocol-buffers/docs/pythontutorial
Just wanted to make sure they both are the same.
Thank you in advance.
bytes. I know in Java, it can be done using toByteArray() method: byte[]
toByteArray(): serializes the message and returns a byte array containing
its raw bytes.
In Python there is SerializeToString() method: SerializeToString():
serializes the message and returns it as a string. Note that the bytes are
binary, not text; we only use the str type as a convenient container.
Found here:
https://developers.google.com/protocol-buffers/docs/pythontutorial
Just wanted to make sure they both are the same.
Thank you in advance.
--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.