title: Python, write in memory zip to file
body: <p>How do I write an in memory zipfile to a file? </p>
  
  <pre><code># Create in memory zip and add files
  zf = zipfile.ZipFile(StringIO.StringIO(), mode='w',compression=zipfile.ZIP_DEFLATED)
  zf.writestr('file1.txt', "hi")
  zf.writestr('file2.txt', "hi")
  
  # Need to write it out
  f = file("C:/path/my_zip.zip", "w")
  f.write(zf)  # what to do here? Also tried f.write(zf.read())
  
  f.close()
  zf.close()
  </code></pre>