| How can we remove one file inside of a zip archive? | | I'm using this method: | | import zipfile | | ziparchive = zipfile.ZipFile('test.odt', 'r') | xmldata = ziparchive.read('content.xml') | ziparchive.close
(Warning: not my area of expertise, but...) Your example *reads* one file from within a zip archive, and is a perfectly good way of doing it (indeed pretty much the only way of doing it). Do I take it you want to end up with the same archive but without that file? If so, I don't believe it's possible as such. What you'd have to do -- and this is almost certainly what any front-end tool will do for you behind-the-scenes -- is to copy the contents of the archive to a temporary file omitting the file(s) in question, and then to rename the temporary file over the original. TJG ________________________________________________________________________ This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor