Login and get coding
In this Bite you will load (deserialize) and dump (serialize) a data structure from / to a
picklefile which support storing your own objects, interesting!
As compared to JSON pickle is a binary serialization format, so it's not human-readable. It can represent an extremely large number of Python types. On the flip side though, deserializing untrusted JSON does not in itself create an arbitrary code execution vulnerability, pickle does which makes it unsecure.
Complete the two following functions to (un)pickle data:
deserialize: loads in the passed in
picklefile path and returns the data structure it retrieves from it (a
serialize: takes a
picklefile path to pickle the data to. It's either the data passed in (second argument) or, if no data is provided (
data is None), it calls
deserializeto get the default data (again a
We hope this Bite gets you up2speed with serializing data using the