python pickle

Save a dictionary into a pickle file.

   import pickle
   favorite_color = { "lion": "yellow", "kitty": "red" }
   pickle.dump( favorite_color, open( "save.p", "wb" ) )
   ```


## Read back in

```python
import pickle
favorite_color = pickle.load( open( "save.p", "rb" ) )
# favorite_color is now { "lion": "yellow", "kitty": "red" }

Convert from Pickle 3 to 2

Simple Pickle 2 to Pickle 3 format.

import pickle
data = pickle.load( open( "titanic.pkl", "rb" ) )
pickle.dump( data, open( "titanic_p2.p", "wb" ),protocol=2 )