offset = len(prefix)
for zipinfo in zip.infolist():
    name = zipinfo.filename
if len(name) > offset:
    zipinfo.filename = name[offset:]
yield zipinfo
args = sys.argv[1:]
if len(args):
    zip = ZipFile(args[0])
path = args[1] if len(args) > 1 else '.'
zip.extractall(path, get_members(zip))
Extract files from zip without keep the top-level folder with python zipfile