Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #90073 > unrolled thread

extracting zip item to in-memory

Started bynoydb <jenn.duerr@gmail.com>
First post2015-05-06 13:27 -0700
Last post2015-05-06 21:45 +0100
Articles 3 — 3 participants

Back to article view | Back to comp.lang.python


Contents

  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

#90073 — extracting zip item to in-memory

Fromnoydb <jenn.duerr@gmail.com>
Date2015-05-06 13:27 -0700
Subjectextracting zip item to in-memory
Message-ID<95e1cce0-18ed-477a-a265-3256b7bcb25a@googlegroups.com>
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

[toc] | [next] | [standalone]


#90074

FromDave Angel <davea@davea.name>
Date2015-05-06 16:38 -0400
Message-ID<mailman.191.1430944712.12865.python-list@python.org>
In reply to#90073
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

[toc] | [prev] | [next] | [standalone]


#90075

FromMark Lawrence <breamoreboy@yahoo.co.uk>
Date2015-05-06 21:45 +0100
Message-ID<mailman.192.1430945144.12865.python-list@python.org>
In reply to#90073
On 06/05/2015 21:27, 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
>

https://docs.python.org/2/library/xml.html#module-xml

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web