title: How do you get the process ID of a program in Unix or Linux using Python?
body: <p>I'm writing some monitoring scripts in Python and I'm trying to find the cleanest way to get the process ID of any random running program given the name of that program</p>
  
  <p>something like</p>
  
  <pre><code>ps -ef | grep MyProgram
  </code></pre>
  
  <p>I could parse the output of that however I thought there might be a better way in python</p>