title: Python zipfile.extract() doesn't extract all files
body: <p>I'm trying to extract zipped folder using code found here.</p>
  
  <pre><code>def unzip(source_filename, dest_dir):
  with zipfile.ZipFile(source_filename) as zf:
  
      for member in zf.infolist():
          words = member.filename.split('/')
          path = dest_dir
          for word in words[:-1]:
              drive, word = os.path.splitdrive(word)
              head, word = os.path.split(word)
              if word in (os.curdir, os.pardir, ''): continue
              path = os.path.join(path, word)
          zf.extract(member, path)
  </code></pre>
  
  <p>But when trying to extract, for example, wordpress.zip with directory structure<br/>
  wordpress/<br/>
  -wp-content/<br/>
  ---somefile.php<br/>
  -wp-config.php<br/>
  -index.php<br/>
  I only get the files in folder below root folder or wordpress/ in this case. So i get wordpress/wp-content/somefile.php but not the files in the wordpress/ folder itself.</p>