英文:
Medium of communication between Python and GO?
问题
我想要读写一些特殊格式的保存文件。然而,我目前的能力只能编译Go源代码,然后用Python调用它并返回JSON。
是否有更好的方法在GO!和Python之间进行通信?
英文:
I would like to read and write to some save files with a special format. The extent of my current capabilities, however, would be to compile the go source and then call it with Python and return JSON.
Is there a better way to communicate between GO! and Python?
答案1
得分: 2
Go有一个用于序列化数据的gob
格式,但是一些golang-nuts的邮件列表讨论表明它不是与其他语言通信的好选择。
JSON可能是一个非常可靠的选择,或者你可以尝试使用protobufs,这也是上述讨论中提到的。
编辑:
根据你的需求,你也可以尝试使用Thrift进行通信,但这可能不太可能是你正在做的事情的候选项。
英文:
Go has a gob
format for serializing data, but some mailing list discussion on golang-nuts suggests that it's not a good choice for communicating with other languages.
JSON would be a very respectable option, or you could try using protobufs which were also suggested in the discussion I linked to above.
EDIT:
You could also try communicating with Thrift depending on your needs, but that's probably a less likely candidate for what you're doing.
答案2
得分: 0
有BSON,你可以将其视为JSON的二进制版本,它有许多语言的实现,包括Go和Python。
英文:
There is BSON, which you can think of as a binary version of JSON, with implementations for many languages including Go and Python.
1: http://bsonspec.org/ "BSON"
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论