Extract files from a zip folder with sub folders into a single folder
<p>I have a zip folder with several subfolders.
testfolder.zip contains files in the given format</p>

<blockquote>
<pre><code>testfolder/files 1,2,3
testfolder/Test1folder/files 5,6
testfolder/Test2folder/files 7,8
</code></pre>
</blockquote>

<p>I need the output as</p>

<blockquote>
  <p>testfolder/files 1,2,3,4,5,6,7,8</p>
</blockquote>

<p>I am able to unzip the folder with its subfolders but not in the desired way.</p>

<p>This is my attempt so far</p>

<pre><code>import glob
import os
import zipfile
folder = 'E:/Test'
extension = '.zip'
zip_files = glob.glob(folder + extension)
for zip_filename in zip_files:
    dir_name = os.path.splitext(zip_filename)[0]
    os.mkdir(dir_name)
    zip_handler = zipfile.ZipFile(zip_filename, "r")
    zip_handler.extractall(dir_name)
</code></pre>

<p>Any help will be very appreciated.Thanks in advance.</p>