Python Tutorial: Zip Files – Creating and Extracting Zip Archives

///Python Tutorial: Zip Files – Creating and Extracting Zip Archives

Python Tutorial: Zip Files – Creating and Extracting Zip Archives

FavoriteLoadingAdd to favorites

In this Python Programming Tutorial, we will be learning how to read and write zip archives.

This video is sponsored by Brilliant. Go to to sign up for free. Be one of the first 200 people to sign up with this link and get 20% off your premium subscription.

In this video, we will be learning how to create and extract zip archives. We will start by using the zipfile module, and then we will see how to do this using the shutil module. We will learn how to do this with single files and directories, as well as learning how to use gzip as well. Let’s get started…

Context Managers Tutorial –
BeautifulSoup Web Scraping Tutorial –
Requests Tutorial –

Stack Overflow Survey Download Page –

✅ Support My Channel Through Patreon:

✅ Become a Channel Member:

✅ One-Time Contribution Through PayPal:

✅ Cryptocurrency Donations:
Bitcoin Wallet – 3MPH8oY2EAgbLVy7RBMinwcBntggi7qeG3
Ethereum Wallet – 0x151649418616068fB46C3598083817101d3bCD33
Litecoin Wallet – MPvEBY5fxGkmPQgocfJbxP6EmTo5UUXMot

✅ Corey’s Public Amazon Wishlist

✅ Equipment I Use and Books I Recommend:

▶️ You Can Find Me On:
My Website –
My Second Channel –
Facebook –
Twitter –
Instagram –

#Python

source

By |2020-12-12T11:11:12+00:00December 12th, 2020|Python Video Tutorials|20 Comments

20 Comments

  1. Corey Schafer December 12, 2020 at 11:11 am - Reply

    I figured out why my zip download doesn't work in this video. It's because the link is opening the zip file within their Google Drive instead of actually downloading the file. If we had used this link then it would have worked:
    https://drive.google.com/uc?export=download&id=1QOmVDpd8hcVYqqUXDXf68UMDWQZP0wQV

    Also, I know many people are eagerly awaiting my Pandas series. I am done with the first 4 videos of the series and almost done with the rest! I should get some time to work more on that series when I go home for Thanksgiving, so I hope to have it released in the next couple of weeks!

  2. ashok sidhu December 12, 2020 at 11:11 am - Reply

    I am A beginner while i watching your Tutorials really very helpful to My Standards. I got More Confidence and Always Enjoying Thanks a lot Sir……

  3. Bobbly December 12, 2020 at 11:11 am - Reply

    Does it work on rar files?

  4. K. M. Taufiqur Rahman December 12, 2020 at 11:11 am - Reply

    I have been following your python tutorial for couple of weeks. I learned a lot from your tutorial. however, I have a question like how can I code so that after making the zip file the previous file (raw file) will be deleted. And, is that possible to make a zip from a list of files but skipping one file. like, 1a1, 1a2, 1b1, 1b2…. here I want to skip 1a2 and 1b1 and want to zip 1a1 and 1b2 separately and delete the skipped file. Thanks in advance for your time.

  5. edd LG December 12, 2020 at 11:11 am - Reply

    Hi Corey, how do you create a zip file but save it directly to another folder instead of the default?

  6. زياد العتيبي December 12, 2020 at 11:11 am - Reply

    you're the best

  7. GSR December 12, 2020 at 11:11 am - Reply

    I getting the error … there is no item named 'xyz.pdf' in the archive ..please help

  8. Frank Garrett December 12, 2020 at 11:11 am - Reply

    Guaranteed you'll never answer this but what application are you using for the script? You kinda jump in and never mention what you're using. As a beginner how am I supposed to know what to use?

  9. Jordi December 12, 2020 at 11:11 am - Reply

    thanks for the tutorial good sir

  10. Thenga Kola December 12, 2020 at 11:11 am - Reply

    Could've included encryption………………………………….Still….nice content

  11. Ryan Aquino December 12, 2020 at 11:11 am - Reply

    how to zip in memory ?

  12. Kanha Taak December 12, 2020 at 11:11 am - Reply

    hii
    I have a file in 500 mb data. the file format is fileName.tar.gz how i can load in jupyter notebook with the help of pandas or another method.

  13. AD Capter December 12, 2020 at 11:11 am - Reply

    How to zip multiple sub-folders lets say 10 sub-folders as individual_folder.zip like Folder1.zip Folder2.zip Folder3.zip and so on…

  14. Naomi Aranda December 12, 2020 at 11:11 am - Reply

    Where do we get the text file ?

  15. Andrew H December 12, 2020 at 11:11 am - Reply

    Keep up the videos Corey…ur videos are phenomenal – best Python educator on YT by far! and love your real world example based method of teaching – which is how i learn best.

  16. Flors Ribalta December 12, 2020 at 11:11 am - Reply

    Super clear! Thank you very much for this! Super useful

  17. Rockies GIS December 12, 2020 at 11:11 am - Reply

    How would you unzip files to a different directory tree than the one saved in the zip file? Thanks

  18. Sanketh B. K December 12, 2020 at 11:11 am - Reply

    How many came through web scraping tutorial

  19. Samarth Saxena December 12, 2020 at 11:11 am - Reply

    Hi Corey Schafer, I have been watching your videos for a while now and I like the fact that you speak everything in the video, but sometimes you don't speak the code out loud and so some of your viewers who can't see the screen won't be able to understand what you're writing and can get lost. So, can you try to make sure that whenever your writing some code on screen, can you speak text out loud, so that people like me, who cannot see anything can also understand what your doing and be able to follow along with your video better? Thanks.

  20. Thanks for the tutorial, I really like the Sublime text theme? What theme is that?

Leave A Comment

*