title: CSV in Python adding an extra carriage return, on Windows
body: <pre class="lang-py prettyprint-override"><code>import csv
  
  with open('test.csv', 'w') as outfile:
      writer = csv.writer(outfile, delimiter=',', quoting=csv.QUOTE_MINIMAL)
      writer.writerow(['hi', 'dude'])
      writer.writerow(['hi2', 'dude2'])
  </code></pre>
  <p>The above code generates a file, <code>test.csv</code>, with an extra <code>\r</code> at each row, like so:</p>
  <pre><code>hi,dude\r\r\nhi2,dude2\r\r\n
  </code></pre>
  <p>instead of the expected</p>
  <pre><code>hi,dude\r\nhi2,dude2\r\n
  </code></pre>
  <p>Why is this happening, or is this actually the desired behavior?</p>