I am trying to ip the files from the list localpath_list
in to one zip file `reports.zip.
It works as expected, but when I extract the reports.zip
file, there are folders created inside it.
i.e all the .xls files are under files/sample/
.
what I need is just the .xls files without any folder structure.
localpath_list = ["files/sample/sample1.xls", "files/sample/sample2.xls", "files/sample/sample3.xls"]
with zipfile.ZipFile(fr"downloads/reports.zip", 'w') as zipF:
for file in localpath_list:
zipF.write(file, compress_type=zipfile.ZIP_DEFLATED)
