Advertisement
cookertron

Python Pickle Example

Jun 21st, 2022
687
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.24 KB | None | 0 0
  1. import pickle
  2.  
  3. a = {'hello': 'world'}
  4.  
  5. with open('filename.pickle', 'wb') as handle:
  6.     pickle.dump(a, handle, protocol=pickle.HIGHEST_PROTOCOL)
  7.  
  8. with open('filename.pickle', 'rb') as handle:
  9.     b = pickle.load(handle)
  10.  
  11. print(a == b)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement