title: Calling a non python program from python?
body: <p>I am currently struggling to call a non python program from a python script.</p>
  
  <p>I have a ~1000 files that when passed through this C++ program will generate ~1000 outputs. Each output file must have a distinct name.</p>
  
  <p>The command I wish to run is of the form:</p>
  
  <pre><code>program_name -input -output -o1 -o2 -o3
  </code></pre>
  
  <p>To date I have tried:</p>
  
  <pre><code>import os
  
  cwd = os.getcwd()
  
  files = os.listdir(cwd)
  
  required_files = []
  
  for i in file:
      if i.endswith('.ttp'):
           required_files.append(i)
  </code></pre>
  
  <p>So, I have an array of the neccesary files. My problem - how do I iterate over the array and for each entry, pass it to the above command (program_name) as an argument and specify a unique output id for each file?</p>