打印人类友好的 Protobuf 消息 [英] Print human friendly Protobuf message

查看:58
本文介绍了打印人类友好的 Protobuf 消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我找不到任何地方可以打印 Google Protobuf 消息的人类友好内容.

I couldn't find anywhere a possibility to print a human friendly content of a Google Protobuf message.

在 Python 中是否有 Java 的 toString() 或 C++ 的 DebugString() 的等价物?

Is there an equivalent in Python for Java's toString() or C++'s DebugString()?

推荐答案

如果您使用的是 protobuf 包,print 函数/语句将为您提供可读的消息表示,因为 __str__ 方法 :-).

If you're using the protobuf package, the print function/statement will give you a human-readable representation of the message, because of the __str__ method :-).

这篇关于打印人类友好的 Protobuf 消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆