PHP » PYTHON |
login |
register |
about
|
PYTHON serialize
is this article helpful?
|
Python replacement for PHP's serialize
[
edit
| history
]
pip install phpserialize
from phpserialize import serialize, unserialize str = serialize({'loginip': '127.0.0.1', 'uid': 96, 'loginfrom': 4, 'logintime': 1317200595}) print str print unserialize(str) or import pickle serialized_obj = pickle.dumps(myObj) serialize(PHP 4, PHP 5) serialize — Generates a storable representation of a value DescriptionGenerates a storable representation of a value This is useful for storing or passing PHP values around without losing their type and structure. To make the serialized string into a PHP value again, use unserialize(). Parameters
Return ValuesReturns a string containing a byte-stream representation of value that can be stored anywhere. Examples
Example #1 serialize() example
<?php
Changelog
Notes
|
more
Recently updated
more
Most requested
more
Last requests
|