On 24/04/14 20:09, Chris wrote:

       for file in files:
          zip.write(file, path.basename(file))
       zip.close() (1)
       print open(name).read() (2)

The ZIP file on the server is okay (1), but when it's sent to the client
(2), there's a linefeed in the last line. This makes the zip invalid. So
how can I remove the last linefeed only?

Can I first ask what makes you think there is an extra
linefeed at the end? Is it because of the print output?
You do remember that print adds a newline?

If you do

print open(name).read(),   # trailing comma suppresses newline

Does it look OK?

Or were already taking that into account?

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos

_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to