replace multiple string in a file
<p>I am trying to replace multiple string in a file.</p>

<pre><code>fp1 = open(final,"w")
data = open(initial).read()
for key, value in mydict.items():
    fp1.write(re.sub(key,value, data)
fp1.close()
</code></pre>

<p>But only my last key value get replaced. how can I replace all the key,value in the file.
Is there any better ways of replacing multiple string in a file.</p>

<p>Thanks</p>

<p>`</p>
