for statement in python
<p>When an exe file is run it prints out some stuff. I'm trying to run this on some numbers below and print out line 54 ( = blah ). It says process isn't defined and I'm really unsure how to fix this and get what I want printed to the screen. If anyone could post some code or ways to fix this thank you so very much!</p>

<pre><code>for j in ('90','52.62263','26.5651','10.8123'):
    if j == '90':
        k = ('0',)
    elif j == '52.62263':
        k = ('0', '72', '144', '216', '288')
    elif j == '26.5651':
        k = (' 324', ' 36', ' 108', ' 180', ' 252')
    else:
        k = (' 288', ' 0', ' 72', ' 144', ' 216')

    for b in k:

        outputstring = process.communicate()[0]
        outputlist = outputstring.splitlines()
        blah = outputlist[53]

        cmd =  ' -j ' + str(j) + ' -b ' + str(b) + ' blah '

        process = Popen(cmd, shell=True, stderr=STDOUT, stdout=PIPE)

        print cmd
</code></pre>

<p>I am trying to print out for example:</p>

<p>-j 90 -az 0  (then what blah contains) blah is line 54. Line 54 prints out a lot of information. Words mostly. I want to print out what line 54 says to the screen right after </p>

<p>-j 90 -az 0</p>

<p>@ Robbie:   line 39</p>

<pre><code>blah = outputlist[53]
</code></pre>

<p>Indexerror: list index out of range</p>

<p>@ Robbie again. Thanks for your help and sorry for the trouble guys... </p>

<p>I even tried putting in outputlist[2] and it gives same error :/</p>
