title: Python Pickle Help
body: <p>I'm not sure why this Pickle example is not showing both of the dictionary definitions. As I understand it, "ab+" should mean that the pickle.dat file is being appended to and can be read from. I'm new to the whole pickle concept, but the tutorials on the net don't seem to go beyond just the initial storage.</p>
  
  <pre><code>import cPickle as pickle
  
  def append_object(d, fname):
      """appends a pickle dump of d to fname"""
      print "append_hash", d, fname
      with open(fname, 'ab') as pickler:
          pickle.dump(d, pickler)
  
  db_file = 'pickle.dat'
  
  cartoon = {}
  cartoon['Mouse'] = 'Mickey'
  append_object(cartoon, db_file)
  
  cartoon = {}
  cartoon['Bird'] = 'Tweety'
  append_object(cartoon, db_file)
  
  print 'loading from pickler'
  with open(db_file, 'rb') as pickler:
      cartoon = pickle.load(pickler)
  print 'loaded', cartoon
  </code></pre>
  
  <p>Ideally, I was hoping to build up a dictionary using a for loop and then add the key:value pair to the pickle.dat file, then clear the dictionary to save some RAM.</p>
  
  <p>What's going on here?</p>