将 Python 对象序列化到 S60 手机/从 S60 手机序列化 Python 对象

发布于 2024-07-10 09:03:46 字数 345 浏览 5 评论 0原文

我正在寻找一种在基于 CherryPy 的服务器和在 Symbian 手机上运行的 Python 客户端之间序列化通用 Python 对象的方法。由于 pyS60 没有实现 pickle 模块,你会怎么做它?

我了解 Cerealizer 但它要求您在使用前注册课程(我会喜欢避免)并且看起来不太成熟..那么,你会用什么? 也许是Python 2.2的pickle模块,从源代码中提取的? XML、JSON? 几个图书馆中的哪一个? :)

I'm looking for a way to serialize generic Python objects between a CherryPy-based server and a Python client running on a Symbian phone.. Since pyS60 doesn't implement the pickle module, how would you do it?

I know about Cerealizer but it requires you to register classes before use (which I'd like to avoid) and doesn't look very mature.. So, what would you use? Python 2.2's pickle module maybe, extracted from the sources? XML, JSON? Which one of the several libraries? :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

扶醉桌前 2024-07-17 09:03:46

使用pickle模块有什么问题?

What's wrong with using the pickle module?

想你的星星会说话 2024-07-17 09:03:46

有人为 PyS60 编写了一个 json 模块。 我只需抓住它,将其序列化为 json 并将其用作网络/客户端应用程序之间的传输方法。

对于 json 库和一本关于 PyS60 的不错的书:
http://www.mobilepythonbook.org/

There is a json module someone wrote for PyS60. I'd simply grab that, serialize things into json and use that as the transfer method between the web/client app.

For the json lib and a decent book on PyS60:
http://www.mobilepythonbook.org/

夏末染殇 2024-07-17 09:03:46

Python 的最新版本(>1.9)具有 pickle 和 cPickle 模块可用

JSON 序列化的另一种替代方法是使用 netstring(查看维基百科)格式进行序列化。 对于二进制对象来说,它实际上比 JSON 更有效。

您可以在这里找到一个很好的 netstring 模块 http://github。 com/tuulos/aino/blob/d78c92985ff1d701ddf99c3445b97f452d4f7fe2/wp/node/netstring.py(或aino/wp/node/netstring.py)

The last versions of Python (>1.9) have the module pickle and cPickle are available

Another alternative to JSON serialization is to use the netstring (look on wikipedia) format to serialize. It's actually more effective than JSON for binary objects.

You can find a good netstring module here http://github.com/tuulos/aino/blob/d78c92985ff1d701ddf99c3445b97f452d4f7fe2/wp/node/netstring.py (or aino/wp/node/netstring.py)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文