title: How to get data from command line from within a Python program?
body: <p>I want to run a command line program from within a python script and get the output.</p>
  
  <p>How do I get the information that is displayed by foo so that I can use it in my script? </p>
  
  <p>For example, I call <code>foo file1</code> from the command line and it prints out</p>
  
  <pre><code>Size: 3KB
  Name: file1.txt
  Other stuff: blah
  </code></pre>
  
  <p>How can I get the file name doing something like <code>filename = os.system('foo file1')</code>? </p>