title: Handling extra newlines (carriage returns) in csv files parsed with Python?
body: <p>I have a CSV file that has fields that contain newlines e.g.:</p>
  
  <pre><code>A, B, C, D, E, F
  123, 456, tree
  , very, bla, indigo
  </code></pre>
  
  <p>(In this case third field in the second row is "tree\n"</p>
  
  <p>I tried the following:</p>
  
  <pre><code>import csv
  catalog = csv.reader(open('test.csv', 'rU'), delimiter=",", dialect=csv.excel_tab)
  for row in catalog:
      print "Length: ", len(row), row
  </code></pre>
  
  <p>and the result I got was this:</p>
  
  <pre><code>Length:  6 ['A', ' B', ' C', ' D', ' E', ' F']
  Length:  3 ['123', ' 456', ' tree']
  Length:  4 ['   ', ' very', ' bla', ' indigo']
  </code></pre>
  
  <p>Does anyone have any idea how I can quickly remove extraneous newlines?</p>
  
  <p>Thanks!</p>