python adding new line at the end of each line
<p>how can I preserve the file structure after substitution.</p>

<pre><code># -*- coding: cp1252 -*-


import os
import os.path
import sys
import fileinput

path="C:\\Search_replace"  # insert the path to the directory of interest
#os.path.exists(path)
#raise SystemExit
Abspath=os.path.abspath(path)
print(Abspath)
dirList=os.listdir(path)
print ('seaching in',os.path.abspath(path))
for fname in dirList:
    if fname.endswith('.txt') or fname.endswith('.srt'):
        #print fname
        full_path=Abspath+"\\"+fname
        print full_path
        for line in fileinput.FileInput(full_path,inplace=1):
            line = line.replace("þ","t")
            line=line.replace("ª","S")
            line=line.replace("º","s")
            print line
print "done"
</code></pre>
