title: Python - getting values from 'interactive' (top, iftop, ntop etc) command line scenarios?
body: <p>Have been needing to write some code that recognises (and captures) when there's incoming/outgoing smb transfers on my server. I think  the  best way is to use popen with 'iftop'.</p>
  
  <p>I was thinking I could just use popen to capture the data, but thing is iftop doesn't simply output the data - its an interactive environment that runs continuously until the user exits. So how can I parse values from these kind of programs into python?</p>
  
  <p>Alternatively - a better option that popen(iftop) ?</p>
  
  <p>Example:</p>
  
  <pre><code>foo.Popen("iftop" + someArguments)
  //this is not stdout, so I can't pull string values (etc) from it :(
  //how does?
  </code></pre>