title: writing terminal output to file
body: <p>On my machine, I have some software which takes commands in the terminal and returns a list of values.</p>
  
  <p>To run it, I have to type something like:</p>
  
  <pre><code>pdv -t filename
  </code></pre>
  
  <p>I am trying to run it as part of a python programme. When I run the following:</p>
  
  <pre><code>os.system('pdv -t %s' % (epoch_name))
  </code></pre>
  
  <p>then I get the values that I desire returned to my terminal (where epoch_name is the variable name for the filename). But when I try to write the result to a file:</p>
  
  <pre><code>os.system('pdv -t %s % "(epoch_name)" &gt; 123.txt')
  </code></pre>
  
  <p>the file 123.txt is produced but it is empty.</p>
  
  <p>I know that I am misplacing the " and/or ' characters, but I can't figure out where they should go.</p>
  
  <p>Any help would be gratefully received!</p>