Hi All,
I am looking for help on this simple script to unzip/extract the contents of a zip file. This is what I have so far:
I had the unzipping working, but not anymore. As is, the script executes w/o error, but doesn't unzip the files. Also, how would you unzip the file to a different directory? Is there a better way to do this then what I'm doing? I got much of this code from a post elsewhere, but am not too sure I follow it.
Thanks!
I am looking for help on this simple script to unzip/extract the contents of a zip file. This is what I have so far:
Code:
import zipfile, os, sys
zip1 = ("C:\\Temp\\test11.zip")
z = zipfile.ZipFile(zip1, 'r')
zList = z.namelist()
for zItem in zList:
print "Unpacking",zItem
zRead = z.read(zItem)
z1File = open(zItem,'wb')
z1File.write(zRead)
z1File.close
print "finished!"
I had the unzipping working, but not anymore. As is, the script executes w/o error, but doesn't unzip the files. Also, how would you unzip the file to a different directory? Is there a better way to do this then what I'm doing? I got much of this code from a post elsewhere, but am not too sure I follow it.
Thanks!
Comment