how to save a pickle file

import pickle

a = {'hello': 'world'}

with open('filename.pickle', 'wb') as handle:
    pickle.dump(a, handle, protocol=pickle.HIGHEST_PROTOCOL)

with open('filename.pickle', 'rb') as handle:
    b = pickle.load(handle)

print a == b

Here is what the above code is Doing:
1. Create a dictionary.
2. Open a file in write binary mode.
3. Dump the dictionary into the file.
4. Close the file.
5. Open the file in read binary mode.
6. Load the dictionary from the file.
7. Close the file.
8. Print whether the two dictionaries are equal.