Retrieving Files from a ZIP File : zip file « File « Python Tutorial






import os
import zipfile


tFile = zipfile.ZipFile("files.zip", 'r')

print tFile.getinfo("input.txt")

buffer = tFile.read("ren_file.py")
print buffer

f = open("extract.txt", "w")
f.write(buffer)
f.close()

tFile.close()








12.25.zip file
12.25.1.Adding Files to a ZIP File
12.25.2.Retrieving Files from a ZIP File