title: Python ZipFile return extracted file path and name
body: <p>I have this current code to unzip the contents of <code>archive</code> to <code>extract_dir</code>. However, I cannot figure out how to get the extracted file path &amp; name of the extracted file.</p>
  
  <pre><code>if archive.endswith((".zip")):
      zip_ref = zipfile.ZipFile(archive, 'r')
      zip_ref.extract(extract_dir)
      zip_ref.close()
  </code></pre>
  
  <p>For example, if the archive is called <code>test.zip</code> and ZipFile extracts the contents <code>test.exe</code> I want get <code>C:/windows/users/admin/downloads/test.exe</code> in to a variable?</p>
  
  <p>EDIT: Sorry I wasn't clear, in the source code for <a href="https://hg.python.org/cpython/file/2.7/Lib/zipfile.py#l1089" rel="nofollow noreferrer">zipfile</a> targetpath is returned I am wondering how I can get this?</p>