title: How to update one file inside zip file?
body: <p>I have this zip file structure.</p>
  <p>zipfile name = <code>filename.zip</code></p>
  <pre><code>filename&gt;    images&gt;
               style.css
               default.js
               index.html
  </code></pre>
  <p>I want to update just <code>index.html</code>. I tried to update <code>index.html</code>, but then it contains only <code>index.html</code> file in 1.zip file and other files are removed.</p>
  <p>This is the code which I tried:</p>
  <pre><code>import zipfile
  
  msg = 'This data did not exist in a file before being added to the ZIP file'
  zf = zipfile.ZipFile('1.zip', 
                       mode='w',
                       )
  try:
      zf.writestr('index.html', msg)
  finally:
      zf.close()
      
  print zf.read('index.html')
  </code></pre>
  <p>So how can I update only <code>index.html</code> file using Python?</p>