在python中如何阅读/理解PHP序列化数据字符串 [英] How to read/make sense of a PHP serialised data string in python

查看:287
本文介绍了在python中如何阅读/理解PHP序列化数据字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过Django访问的遗留数据库有一个表列,以下列字符串格式存储序列化数据:

A legacy database I'm accessing via Django has a table column that stores serialised data in the following string format:

a:5:{i:1;s:4:"1869";i:2;s:4:"1859";i:3;s:4:"1715";i:4;s:1:"0";i:5;s:1:"0";}

有什么办法吗可以使用python / python-library将其更改为列表或任何其他友好的python数据类型以进一步处理各个值?

Is there any way I can use python/python-library to change it into a list or any other friendly python data type for further processing of individual values?

注意:这些值已写入数据库通过PHP。

Note: These values were written to the database via PHP.

推荐答案

phpserialize


serialize的端口 unserialize php到python的函数。该模块实现了python序列化接口(例如:提供转储加载和类似的功能)...

a port of the serialize and unserialize functions of php to python. This module implements the python serialization interface (eg: provides dumps, loads and similar functions)...

这篇关于在python中如何阅读/理解PHP序列化数据字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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