Learning Python: Print 3 consecutives lines from a PIPE
<p>i have the following code:</p>

<pre><code>def cmds(cmd):
    cmd= Popen(cmd, shell=True, stdout=PIPE)
    lines = command.stdout.read().splitlines()
</code></pre>

<p>I have a command that outputs lines like this:</p>

<pre><code>2011/03/30-201
CLIENT 3
Failed
23:17
0.0000

2011/03/31-3
CLIENT 2
Completed
00:47
1.0019
</code></pre>

<p>I want to read the first 3 lines for a block, then more 3 lines for next block and more 3 ...
I do have no idea how to do this.</p>
