Skip to content
Advertisement

Tag: zip

Creating a function that works like “zip”

I am trying to make a function that does something similar to “zip”. My problem is that the part doesn’t work. In the case below, it should take every third element from the L4, and append it to a new list, so I ended up with [[1, 4, 7], [2, 5, 8], [3, 6, 9]], but that is not really

How to avoid subfolders creation while zipping files?

I am trying to zip 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. Answer According to: [Python.Docs]: zipfile –

Is there any method to compress ZIP files in python?

I have tried creating zip using zipfile and shutil. But, there was not visible file size compression in both the methods. zipfile shutil Is there any way to ensure file compression as well? Thanks. Answer You did zipfile.ZipFile docs state The compresslevel parameter controls the compression level to use when writing files to the archive. When using ZIP_STORED or ZIP_LZMA

Python associate function

I want to add the file extensions found in the function to the line of code where I specified “HERE”. In other words, not only “.txt”, but also the extensions of the above function should be brought that part. In short, I want to associate the following code with the function. Can you help me, with this? Answer Assuming that

Advertisement