title: How to remove ^M
body: <p>How can I remove the <code>^M</code> character from a text file (at the end of line) in a Python script?</p>
  
  <p>I did the following, and there are <code>^M</code> at every line-break.</p>
  
  <pre><code>file = open(filename, "w")
  file.write(something)
  </code></pre>