title: Saving pickle object at each iteration without writing whole object each time
body: <p>I am trying to save a dictionary as a pickle object.</p>
  
  <p>My dictionary gets bigger and bigger at each iteration in a long for loop, could I save it at each iteration in an efficient manner, such that I only save the additional key:value pair at each iteration instead of re-saving the whole dictionary?</p>
  
  <p>Example:</p>
  
  <pre><code>import pickle 
  
  keys = [123,11,2,5]
  values = [[10,3,2,1],[0],[1],[2,3],[3]]
  
  for i in range(0,4):
      mydict[keys[i]] = values[i]
  pickle.dump(mydict, open('/mydir/mydict.p','w'))
  </code></pre>
  
  <p>As one can see here I save mydict at the end of the loop, but ideally I'd save it at each part of the for loop in an efficient manner.</p>