<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Python Pickle Example Binary Storage on shocksolution.com</title><link>https://shocksolution.com/tags/python-pickle-example-binary-storage/</link><description>Recent content in Python Pickle Example Binary Storage on shocksolution.com</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Mon, 15 Sep 2008 22:23:18 +0000</lastBuildDate><atom:link href="https://shocksolution.com/tags/python-pickle-example-binary-storage/index.xml" rel="self" type="application/rss+xml"/><item><title>Python Pickle: Painless binary storage for Python objects</title><link>https://shocksolution.com/posts/python-pickle-painless-binary-storage-for-python-objects/</link><pubDate>Mon, 15 Sep 2008 22:23:18 +0000</pubDate><guid>https://shocksolution.com/posts/python-pickle-painless-binary-storage-for-python-objects/</guid><description>&lt;p&gt;The &lt;a href="http://docs.python.org/lib/module-pickle.html"&gt;pickle&lt;/a&gt; module provided with Python is so useful that I&amp;rsquo;m surprised I haven&amp;rsquo;t used it before. Pickle allows you to save an entire data structure (such as an object) to disk as a binary file in a effortless (and fairly efficient) manner. For example, in my latest project I have created a Monte Carlo simulation that can take quite a bit of time to run. I also need to make multiple runs to get statistics on the results. At the end of each run, I need to dump the resulting data to disk so that it can be read in later by an analysis program. If I had to write data in a format that could be interchanged with other scientific software, I&amp;rsquo;d use the &lt;a href="http://hdf.ncsa.uiuc.edu/HDF5/"&gt;hdf5&lt;/a&gt; format with the &lt;a href="http://%3C%3Cwww.pytables.org/moin&amp;amp;gt%3E;"&gt;pytables&lt;/a&gt; package. However, right now I just need to get something working, and the pickle module is perfect. Here is how I save an object called box:&lt;/p&gt;</description></item></channel></rss>