def zipit(dirname, zfname):
 zf = zipfile.ZipFile(zfname, 'w')
 for (root, ignored, files) in os.walk(dirname):
  for fname in files:
   fspath = os.path.join(root, fname)
   arcpath = os.path.join(root, fname)[(len(dirname) + 1):]
   zf.write(fspath, arcpath)
 zf.close()

def zipit ( dirname , zfname ) : zf = zipfile . ZipFile ( zfname , 'w' ) for ( root , ignored , files ) in os . walk ( dirname ) : for fname in files : fspath = os . path . join ( root , fname ) arcpath = os . path . join ( root , fname ) [ ( len ( dirname ) + 1 ) : ] zf . write ( fspath , arcpath ) zf . close ( )
create a zipfile on zfname .