maci.pickledumpbytes
dump data to pickled bytes
Last updated
dump data to pickled bytes
Last updated
Dump data to pickled object byte string.
Security awareness, only unpickle data you trust and review considerations for unpickling data. See more information at
Basic Example of dumping data to pickled byte string using default positional parameter
In this example, we simply dump data using the pickledumpbytes function and pass any data as an argument to the function to dump it to pickled object data, and assign the returned data to a variable.
To store pickled data to a file, it is more encouraged to store it as a byte string value rather than a whole executable pickle file. The byte string itself is not executable yet as it is stored as a value that can be safely tested (using your own means) before loading it. This approach enables the ability to still store your pickle data to a file as an alternative, and control what byte data is coming in instead of just loading/executing a whole pickle file.
Example storing pickled data to a file as a value using maci, and loading it back
Right before unpickling the data, that could be a point to check the integrity of the byte string value before processing it.
Functions that are related for pickledumpbytes
Describes all parameter functionality and accepted data types
In the example part for dumping, we simply create an empty using and use the pickledumpbytes function on our data to assign it to a new attribute name created on our maci object, then dump the maci data using to a file called 'my.data'.
In the example part for loading the data back, we simply load in the file called 'my.data' using and assign the newly imported maci object to a variable, then using the partner function , we unpickle the attribute name on the maci object with the assigned pickled byte string data back to a variable.
-> Load data from pickled bytes
This uses the native pickle library shipped with the python standard library for its underlying functionality. For more information on the pickle library and official security concerns with pickling, visit: