Mega Code Archive

 
Categories / Python Tutorial / File
 

Retrieving Files from a ZIP File

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()