"Neil Crighton" <[EMAIL PROTECTED]> wrote: > 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, > Zip files aren't text. Try opening the zipfile file in binary mode:
open('zippedfile.zip', 'rb') -- http://mail.python.org/mailman/listinfo/python-list