title: execute python script multiple times
body: <p>Im not sure about the best way to do this but I have a python script saved as a .py. The final output of this script is two files x1.txt and y1.txt.</p>
  
  <p>Basically I want to run this script say 1000 times and each run write my two text files with new names i.e x1.txt + y1.txt then second run x2.txt and y2.txt.</p>
  
  <p>Thinking about this it seems it might be better to start the whole script with something like</p>
  
  <pre><code>runs=xrange(:999)
  for i in runs:
  
  ##run the script
  </code></pre>
  
  <p>and then finish with something that does</p>
  
  <pre><code>    for i in runs:
          filnameA=prefix += "a"+i
  
  
  open("filnamea.txt", "w").write('\n'.join('\t'.join(x for x in g if x) for g in grouper(7, values)))
  
  
      for i in runs:
          filnameB=prefix += "a"+i
  
  
  open("filnameB.txt", "w").write('\n'.join('\t'.join(x for x in g if x) for g in grouper(7, values)))
  </code></pre>
  
  <p>Is this really the best way to do it? I bet its not..better ideas?</p>
  
  <p>I know you can <code>import time</code> and write a filename that mathes time but this would be annoying for processing later.</p>