Problem with zipfile and newlines
Neil Crighton
neilcrighton at gmail.com
Mon Mar 10 05:31:37 EDT 2008
I'm using the zipfile library to read a zip file in Windows, and it
seems to be adding too many newlines to extracted files. I've found
that for extracted text-encoded files, removing all instances of '\r'
in the extracted file seems to fix the problem, but I can't find an
easy solution for binary files.
The code I'm using is something like:
from zipfile import Zipfile
z = Zipfile(open('zippedfile.zip'))
extractedfile = z.read('filename_in_zippedfile')
I'm using Python version 2.5. Has anyone else had this problem
before, or know how to fix it?
Thanks,
Neil
More information about the Python-list
mailing list