how to run a python file 20 times with 1000 iterations
<p>i want to run a python file file.py 20 times with 1000 iterations with single run click so that i dont need to click run 20 times manually.</p>

<pre><code>Init()
globalBest=pop[0].chromosome

# Saving Result

fp=open(resultFileName,"w");
fp.write("Iteration,Fitness,Chromosomes\n")

for i in range(0,iterations):
    Crossover()
    Mutation()
    MemoriseGlobalBest()

    if funEval &gt;=maxFunEval:
        break

  if i%20==0:
     print "I:",i,"\t Fitness:", bestFitness
     fp.write(str(i) + "," + str(bestFitness) + "," + str(bestChromosome) + "\n")

print "I:",i+1,"\t Fitness:", bestFitness
fp.write(str(i+1) + "," + str(bestFitness) + "," + str(bestChromosome))    
fp.close()
</code></pre>

<p>try:</p>

<pre><code>for iteration in range(20):
    Init()
    globalBest = pop[0].chromosome

    # Saving Result

    fp = open(resultFileName, "a")
    fp.write("Iteration,Fitness,Chromosomes\n")

    for i in range(0, iterations):
        Crossover()
        Mutation()
        MemoriseGlobalBest()

        if funEval &gt;= maxFunEval:
            break

    if i % 20 == 0:
        print
        "I:", i, "\t Fitness:", bestFitness
        fp.write(str(i) + "," + str(bestFitness) + "," + str(bestChromosome) + "\n")

    print
    "I:", i + 1, "\t Fitness:", bestFitness
    fp.write(str(i + 1) + "," + str(bestFitness) + "," + str(bestChromosome))
    fp.close()
</code></pre>

python optimization