Jan-31-2018, 02:59 PM
This snippet works:
The error-handling is your task :-P
def list_zip(file, filename=None): zf = zipfile.ZipFile(file, 'r') for cf in zf.filelist: print(zf.filename or filename, cf.filename, sep=': ') if cf.filename.lower().endswith('.zip'): with zf.open(cf.filename, 'r') as new_zf: list_zip(io.BytesIO(new_zf.read()), cf.filename)The argument filename is only used to hand over the recursive call the current name of the open zip file.
The error-handling is your task :-P
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
All humans together. We don't need politicians!