title: Replace text in file with Python
body: <p>I'm trying to replace some text in a file with a value. Everything works fine but when I look at the file after its completed there is a new (blank) line after each line in the file. Is there something I can do to prevent this from happening.</p>
  
  <p>Here is the code as I have it:  </p>
  
  <pre><code>  import fileinput
      for line in fileinput.FileInput("testfile.txt",inplace=1):
         line = line.replace("newhost",host)
         print line
  </code></pre>
  
  <p>Thank you,
  Aaron</p>