Astley Le Jasper wrote:
I want to batch extract files from a directory of zips. The thing is
that the files are excel spreadsheets. I don't want to read them in
python, just dump them as extracted files in another directory.
However, when I do a test the excel file becomes corrupted. Any clues?
import zipfile
zf = zipfile.ZipFile('C:\Temp\mytest.zip')
filename = 'spreadsheet.xls'
data = zf.read(filename)
uz_file = 'C:\Temp\' + filename
Be careful of backslashes in strings!
f = open(uz_file, "w")
Open as a binary file:
f = open(uz_file, "wb")
f.write(data)
f.close()
--
http://mail.python.org/mailman/listinfo/python-list