with zipfile.ZipFile(tDir + mainapk[0]) as z:
    with z.open(icon[1]) as zf:
        with open(os.path.join(tDir, os.path.basename(icon[1])), 'wb') as f:
            shutil.copyfileobj(zf, f)
Extract a specific file from a zip archive without maintaining directory structure in python