fork download
  1. # your code goes here
  2. def save_state(self):
  3. s = shelve.open('myshelf')
  4. s['myclass'] = self
  5. s.close()
  6. print("Saved state of structure to file.")
  7.  
  8. def __del__(self):
  9. self.save_state()
Success #stdin #stdout 0.03s 9944KB
stdin
Standard input is empty
stdout
Standard output is empty