Guest User

Untitled

a guest
Feb 19th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. class Character(object):
  4. """Crude example."""
  5.  
  6. me = Character()
  7. me.name = "God"
  8. me.stats = [1, 2, 3, 4, 5]
  9.  
  10. import pickle
  11.  
  12. pickle.dump(me, file("me.character", "w"))
  13.  
  14. del me
  15.  
  16. me = pickle.load(file("me.character", "r"))
  17.  
  18. print(me.name)
  19. print(me.stats)
  20.  
  21. # Prints:
  22. # God
  23. # [1, 2, 3, 4, 5]
Add Comment
Please, Sign In to add comment