In this video, Kathryn teaches you how to manipulate .zip files using Python's zipfile module. Learn how to access the metadata of a .zip file, as well as read the contents of each file contained within the .zip. Finally, learn how to extract .zip files using Python.
- [Instructor] Before we use the Zipfile Module…let's create some files…and then zip them up in a zipfile.…We're going to create two files…and the first one that we're going to create…is going to be called "purchased.txt",…and inside of here, we'll print a couple things,…say things you've purchased are…apples, towels, and candy.…These are things that you've purchased in the past week.…And then we're going to create another file…and it is going to be called "wishlist.txt".…
And again, this can hold any type of data,…but say the thing that is on your wishlist…is an iPhone.…And so now that we have these two files set up for us,…we're going to go into the Finder and zip them up.…And so here are the two files…and we'll go ahead and select them both,…and then just compress the two items,…and now they're both in this archive here.…And now to make sure that these two files…don't mess with anything else,…we're going to go ahead and just put them somewhere else…where we don't have to deal with them.…
Back in the code here,…
- Working with logical and comparison operators
- Getting a list of numbers with the range() and list() functions
- Using mathematical functions such as round(), abs(), and pow()
- Calculating a given input's length
- Importing and using the math module
- Reading a user's command-line arguments
- Getting the current time
- Formatting dates and times with datetime
- Creating a timer
- Using urllib to get content from the Internet
- Using the JSON module to decode content
Skill Level Intermediate
1. Python: What's Built-In?
2. Python: Math
3. Python: Input/Output
4. Python: Date & Time, HTML Parsing, and HTTP
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.