convert the output from Popen to an array
<p>I try to find the process ID on linux OS with python script, with following:</p>

<pre><code>  PID = Popen("ps -elf | grep &lt;proc_name&gt;| grep -v grep | awk '{print $4}'", shell=True, stdout=PIPE).stdout
  pid = PID.read()
  pid=int(pid)
</code></pre>

<p>However, the script does not work if there are more than one PIDs with the same 
The program exits at the  int() function due to '123\n146\n' is not the 10 based int</p>

<p>I then tried the following:
      pid= Pid.read().split()<br>
      print len(pid)<br>
      print pid[0]</p>

<p>It seems to work with the python command line and forms an array of pid =['123','156'], but somehow, it does not work in the script.</p>

<p>any suggestion ?  thanks</p>
