Extracted files form zip corrupted

Astley Le Jasper Astley.lejasper at gmail.com
Thu Mar 26 08:13:02 EDT 2009


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
f = open(uz_file, "w")
f.write(data)
f.close()

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>



More information about the Python-list mailing list