Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python zipfile module: difference between zipfile.ZIP_DEFLATED and zipfile.ZIP_STORED

Tags:

python

zipfile

I have difficult to understand the difference between zipfile.ZIP_DEFLATED and zipfile.ZIP_STORED compression modes of the zipfile module.

Someone could help me?

thanks,

Max

like image 430
maxim Avatar asked Mar 14 '11 11:03

maxim


People also ask

What is ZIP file Zip_deflated?

ZIP_STORED. The numeric constant for an uncompressed archive member. zipfile. ZIP_DEFLATED. The numeric constant for the usual ZIP compression method.

What is ZIP file ZIP file?

ZIP is an archive file format that supports lossless data compression. A ZIP file may contain one or more files or directories that may have been compressed. The ZIP file format permits a number of compression algorithms, though DEFLATE is the most common.

Which statement successfully creates a ZIP file using the ZIP file module in Python?

with ZipFile(file_name, 'r') as zip: Here, a ZipFile object is made by calling ZipFile constructor which accepts zip file name and mode parameters. We create a ZipFile object in READ mode and name it as zip.

What ZIP file method is equivalent to file objects open () method in Python?

The zipfile. ZipFile() function is equivalent to the open() function; the first argument is the filename, and the second argument is the mode to open the ZIP file in (read, write, or append).


1 Answers

ZIP_DEFLATED correspond to an archive member (a file inside the archive) which is compressed (or deflated). ZIP_STORED correspond to an archive member which is simply stored, without being compressed, quite the same as an archive member inside a tar file.

like image 93
Adrien Plisson Avatar answered Oct 01 '22 02:10

Adrien Plisson