Skip to content

Instantly share code, notes, and snippets.

@Everfighting
Created May 18, 2017 15:00
Show Gist options
  • Save Everfighting/b038c291c8ac66deac2861ab58538dd0 to your computer and use it in GitHub Desktop.
Save Everfighting/b038c291c8ac66deac2861ab58538dd0 to your computer and use it in GitHub Desktop.
>>> import pickle
>>> f = open('somedata', 'wb')
>>> pickle.dump([1, 2, 3, 4], f)
>>> pickle.dump('hello', f)
>>> pickle.dump({'Apple', 'Pear', 'Banana'}, f)
>>> f.close()
>>> f = open('somedata', 'rb')
>>> pickle.load(f)
[1, 2, 3, 4]
>>> pickle.load(f)
'hello'
>>> pickle.load(f)
{'Apple', 'Pear', 'Banana'}
>>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment