->PICKLE
platformThe ->PICKLE
function converts the object on top of the stack to a Python object and serializes it using Pickle protocol version 2.
The conversion table used is as follow:
WarpScript | Python |
---|---|
NULL | None |
BOOLEAN | bool |
BYTES | bytearray |
STRING | str/unicode |
DOUBLE | float |
LONG | int |
LIST | list |
MAP | dict |
SET | set |
GTS | dict |
ENCODER | dict |
Other types are unsupported.
Python examples with ->PICKLE ->HEX
output:
Python2
>>> s="80025d71002858060000005049434b4c4571015806000000535452494e4771025d7103284b0547400921fb54442d1865652e"
>>> import pickle
>>> pickle.loads(s.decode("hex"))
[u'PICKLE', u'STRING', [5, 3.141592653589793]]
Python3
>>> s="80025d71002858060000005049434b4c4571015806000000535452494e4771025d7103284b0547400921fb54442d1865652e"
>>> import pickle, codecs
>>> pickle.loads(codecs.decode(s, "hex"))
['PICKLE', 'STRING', [5, 3.141592653589793]]