Guest User

Untitled

a guest
Nov 24th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. import pickle
  2.  
  3. class A:
  4. def __init__(self):
  5. pass
  6. class C:
  7. def __init__(self):
  8. print("deva")
  9. pass
  10.  
  11. def a(self):
  12. print("yeah!")
  13. pass
  14.  
  15. class B:
  16. def __init__(self):
  17. self.b = A.C()
  18. self.b1=1
  19.  
  20. b = B()
  21. print ("ok, object created")
  22. my_pickled_b = pickle.dumps(b)
  23. print ("ok, object pickled, here it is...")
  24. print (my_pickled_b)
  25. print ("trying to unpickle it ...")
  26. c = pickle.loads(my_pickled_b)
  27. print ("unpickled! here it is:")
  28. print (c)
  29. print ("and this is the value of c.b1 : ")
  30. print (c.b1)
  31. c.b.a()
Add Comment
Please, Sign In to add comment