Chris Rebert wrote:
On Wed, Feb 4, 2009 at 1:22 AM, Helmut Jarausch <jarau...@skynet.be> wrote:
Hi,

using e.g.
import subprocess
Package='app-arch/lzma-utils'
EQ=subprocess.Popen(['/usr/bin/equery','depends',Package],stdout=subprocess.PIPE)
EQ_output= EQ.communicate()[0]

EQ_output is a string containing multiple lines.

I'd prefer a file-like object, e.g. EQ_OUT
so that I can loop over the lines of it like

for line in EQ_OUT :
 ...

Is there some reason that:

for line in EQ_OUT.splitlines():
    #...

Does not meet your needs?


It works, but it still reads the complete output of the
command executed by Popen at once.

Helmut.


--
Helmut Jarausch

Lehrstuhl fuer Numerische Mathematik
RWTH - Aachen University
D 52056 Aachen, Germany
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to