title: How to add multiple files into a single zip folder
body: <p>Actually i am writting a script which writes two files into a desktop, let it be as "a.txt" and "b.txt"....... so after writing into a desktop i have to read this files and zip into a folder....</p>
  
  <p>can anyone help on this....i know how to zip a folder but dono how to add two files in to a zip</p>
  
  <p>Reading from folder i know its like this</p>
  
  <pre><code>def zipdir(basedir, archivename):
      assert os.path.isdir(basedir)
      with closing(ZipFile(archivename, "w", ZIP_DEFLATED)) as z:
          for root, dirs, files in os.walk(basedir):
              for fn in files:
                  absfn = os.path.join(root, fn)
                  zfn = absfn[len(basedir)+len(os.sep):]
                  z.write(absfn, zfn)
  
  if __name__ == '__main__':
      import sys
      basedir = sys.argv[1]
      archivename = sys.argv[2]
      zipdir(basedir, archivename)
  </code></pre>
  
  <p>The code which now i using is</p>
  
  <pre><code>import zipfile
  zip = zipfile.ZipFile('Python.zip', 'a')
  zip.write('fields.txt')
  zip.write('grp.txt')
  zip.close()
  </code></pre>
  
  <p>This is creating file of those two plus some extra folder which contains all files.......</p>