Unserialize PHP data in python

17,577

Solution 1

Are you looking for phpserialize?

Solution 2

If you don't need object serialization (which can be compensated with associative arrays), then a faster alternative might be this: http://code.google.com/p/serek/ (it's a Python module written in C)

It's used in production servers under heavy load at my company, so I might recommend it as stable. There is no tarball available, though. So you have to grab it straight from the repository.

Share:
17,577
Chris Salij
Author by

Chris Salij

Updated on June 04, 2022

Comments

  • Chris Salij
    Chris Salij almost 2 years

    Possible Duplicate:
    How to read/make sense of a PHP serialised data string in python

    I'm using python to access a database which is managed by a Drupal install. The data I want to access in Drupal in saved in the database as a PHP serialized object.

    Are there any pre-built python modules which can deserialize a PHP serialized object into a python object? I've done some searching and come up with nothing.

    I realize I could write my own parser from scratch but I'd rather use something thats been tried and tested.

  • William
    William about 8 years
    There's a Python library for everything...
  • horcle_buzz
    horcle_buzz about 8 years
    Indeed there is. Thanks for this. Saved me a LOT of work.
  • DomonLee
    DomonLee about 5 years
    OMG, Thank you. Python 3rd part libs saved me.