![python zip files python zip files](https://pythonguides.com/wp-content/uploads/2021/11/Download-zip-file-from-Azure-blob-storage-python-1024x852.png)
#Python zip files archive#
Here the import statement for the archive is from shutil import makearchive. Step 1) To create an archive file from Python, make sure you have your import statement correct and in order.
#Python zip files zip file#
Step 5) When you -> right click on file (testguru99.zip) and -> select your O.S (Windows Explorer), it will show the archive files in the folder as shown below. Here are the steps to create Zip File in Python. Note: Here we don’t give any command to “close” the file like “newzip.close” because we use “With” scope lock, so when program falls outside of this scope the file will be cleaned up and is closed automatically. When you execute the code you can see the file is created on the right side of the panel with name “guru99.zip”
![python zip files python zip files](https://www.codesnail.com/wp-content/uploads/2020/12/create-and-extract-zip-file-using-python.png)
Now your archive.zip file will appear on your O.S (Windows Explorer) Step 2) Once your archive file is made, you can right-click on the file and select the O.S, and it will show your archive files in it as shown below When you run the code, you can see the archive zip file is created on the right side of the panel.
![python zip files python zip files](https://www.thepythoncode.com/media/articles/zip-file-password-cracker-in-python.png)
So everything in the directory will be zipped