Using zip file, I indicate files locate within an other folder for example: './data/2003-2007/metropolis/Matrix_0_1_0.csv'
My problem is that, when I extract it, the files are found in ./data/2003-2007/metropolis/Matrix_0_1_0.csv
, while I would like it to be extract in ./
Here is my code:
def zip_files(src, dst):
zip_ = zipfile.ZipFile(dst, 'w')
print src, dst
for src_ in src:
zip_.write(src_, os.path.relpath(src_, './'), compress_type = zipfile.ZIP_DEFLATED)
zip_.close()
Here is the print of src and dst:
['./data/2003-2007/metropolis/Matrix_0_1_0.csv', './data/2003-2007/metropolis/Matrix_0_1_1.csv'] ./data/2003-2007/metropolis/csv.zip