title: zip file and avoid directory structure
body: <p>I have a Python script that zips a file (<code>new.txt</code>):</p>
  
  <pre><code>tofile =  "/root/files/result/"+file
  targetzipfile = new.zip # This is how I want my zip to look like
  zf = zipfile.ZipFile(targetzipfile, mode='w')
  try:
      #adding to archive
      zf.write(tofile)
  finally:
      zf.close()
  </code></pre>
  
  <p>When I do this I get the zip file.  But when I try to unzip the file I get the text file inside of a series of directories corresponding to the path of the file i.e I see a folder called <code>root</code> in the <code>result</code> directory and more directories within it, i.e. I have </p>
  
  <pre><code>/root/files/result/new.zip
  </code></pre>
  
  <p>and when I unzip <code>new.zip</code> I have a directory structure that looks like </p>
  
  <pre><code>/root/files/result/root/files/result/new.txt
  </code></pre>
  
  <p>Is there a way I can zip such that when I unzip I only get <code>new.txt</code>?</p>
  
  <p>In other words I have <code>/root/files/result/new.zip</code> and when I unzip <code>new.zip</code>, it should look like </p>
  
  <pre><code>/root/files/results/new.txt
  </code></pre>