title: Store output of subprocess.Popen call in a string
body: <p>I'm trying to make a system call in Python and store the output to a string that I can manipulate in the Python program.</p>
  
  <pre><code>#!/usr/bin/python
  import subprocess
  p2 = subprocess.Popen("ntpq -p")
  </code></pre>
  
  <p>I've tried a few things including some of the suggestions here:</p>
  
  <p><a href="https://stackoverflow.com/questions/1996518/retrieving-the-output-of-subprocess-call">Retrieving the output of subprocess.call()</a></p>
  
  <p>but without any luck.</p>