Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Protobuf

protoc should be preinstalled

protoc --python_out=. mything.proto


In python:

from google.protobuf import text_format
import mything_pb2

meta = mything_pb2.BaseMessage()

with open("mythingfile.pb", "r") as f:
    text_format.Parse(f.read(), meta)

print(meta)