Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #90074
| Date | 2015-05-06 16:38 -0400 |
|---|---|
| From | Dave Angel <davea@davea.name> |
| Subject | Re: extracting zip item to in-memory |
| References | <95e1cce0-18ed-477a-a265-3256b7bcb25a@googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.191.1430944712.12865.python-list@python.org> (permalink) |
On 05/06/2015 04:27 PM, noydb wrote: > I have a zip file containing several files and I want to extract out just the .xml file. I have that code. Curious if this xml file can be extracted into memory. If so, how to? I only need to move the file around, and maybe read some tags. > > Thanks for any help! > > python 2.7 > See https://docs.python.org/2.7/library/zipfile.html#zipfile.ZipFile.open To open a particular member and get back a file-like object. Once you have that, you can use the read() method of that object. Once you've coded this, if it doesn't work, post what you've got with a description of what doesn't work, and somebody here will be able to fix it up. -- DaveA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
extracting zip item to in-memory noydb <jenn.duerr@gmail.com> - 2015-05-06 13:27 -0700 Re: extracting zip item to in-memory Dave Angel <davea@davea.name> - 2015-05-06 16:38 -0400 Re: extracting zip item to in-memory Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-05-06 21:45 +0100
csiph-web