I am trying to create zipfile using python 3.4. Upon execution following error is shown:
AttributeError: 'module' object has no attribute 'Zipfile'
My code:
import zipfile
f= zipfile.Zipfile("testZIP.zip","w")
Create a zip archive from multiple files in PythonCreate a ZipFile object by passing the new file name and mode as 'w' (write mode). It will create a new zip file and open it within ZipFile object. Call write() function on ZipFile object to add the files in it. call close() on ZipFile object to Close the zip file.
empty_zip_data is the data of an empty zip file. For Python 3 use empty_zip_data = b'PK\x05... .
Python's zipfile is a standard library module intended to manipulate ZIP files. This file format is a widely adopted industry standard when it comes to archiving and compressing digital data. You can use it to package together several related files.
It is zipfile.ZipFile
with a capital F
not zipfile.Zipfile
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With