"Dr. Who" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Well, I finally managed to solve it myself by looking at some code.
> The solution in Python is a little non-intuitive but this is how to get
> it:
>
> while 1:
>     line = stdout.readline()
>     if not line:
>         break
>     print 'LINE:', line,
>
> If anyone can do it the more Pythonic way with some sort of iteration
> over stdout, please let me know.
>
> Jeff


You can use the sentinel form of iter():

for line in iter(stdout.readline, ''):
    print 'LINE:', line,


George


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to