python: use a increasing variable to repalce
<p>i write a small script as follow</p>

<pre><code>f1 = open('file.txt', 'r')     
f2 = open('newfile.txt', 'w')     
n=5000

for line in f1:         
      f2.write(line.replace('12345', n))    
      n=n+1

f1.close()     
f2.close()
</code></pre>

<p>but <code>.replace('old','new')</code> can not apply to a variable. any people hav idea to solve this?</p>
