Warning: This post is multiple years out of date. The content is left up for reference and keeping links valid, but there is likely better, more up to date content available.
Note: This is the fourth post in the Bulk Tag Generation in Python series.
Working with ZIP files in Python is pretty easy. Just import the
zipfile module, and you're pretty much done.
Here's some sample code:
import zipfile myzip = zipfile.ZipFile("something.zip") file_list = myzip.namelist() file_data = [myzip.read(filename) for filename in file_list]
Just import the module, open the zip, get a file list out, and then you have a list containing all the data in each of the files. Pretty nifty, isn't it?
PS: Hopefully the time difference between blog posts will go down soon.