In python how can i print only the first line of stdout which results from a shell command
<p>in the following for loop, i print the version number of program installed</p>

<pre>
 for program in sub3_required_programs:
        try:
            version = subprocess.call([program, '-i'])                                                                     
            print version + '\n'
        except:
            exit
</pre>

<p>But i actually want only the first line which has the version number. How can i restrict the print to only the first line</p>
