title: Save a class into a binary file - Python
body: <p>I'm aware that saving a class into a binary file in c++ is possible using:</p>
  
  <pre><code>file.write(Class_variable, size_of_class, amount_of_saves, file_where_to_save)
  </code></pre>
  
  <p>or something similar, and I wanted to use that in python in order to make it easier to write and read lots of data.</p>
  
  <p>I've tried to do this:</p>
  
  <pre><code>def Save_Game(player, room):
      address = 'Saves/player'
  
      file = open(address, 'wb')
      file.write(player)
  
      address = 'Saves/room'
  
      file = open(address, 'wb')
      file.write(room)
  </code></pre>
  
  <p>Room and player being class_objects. But it says: </p>
  
  <pre><code>TypeError: must be convertible to a buffer, not PlayerMarty
  </code></pre>
  
  <p>What can I do?</p>