| author | ymh <ymh.work@gmail.com> |
| Wed, 20 Jan 2010 00:34:04 +0100 | |
| changeset 0 | 0d40e90630ef |
| child 35 | 8b65c9054eac |
| permissions | -rw-r--r-- |
import zipfile, os, os.path class ZipFileExt(zipfile.ZipFile): def unzip_into_dir(self, dir): if not os.path.exists(dir): os.mkdir(dir, 0777) for name in self.namelist(): if name.endswith('/'): os.mkdir(os.path.join(dir,name)) else: outfile = open(os.path.join(dir,name), 'wb') outfile.write(self.read(name)) outfile.close()