title: Python Write a list into csv, can't put values into a column
body: <p>I have this list of countries:</p>
  
  <pre><code>country = ['Togo', 'Nauru', 'Palestine, State of', 'Malawi']
  </code></pre>
  
  <p>I'm trying to write this into a csv:</p>
  
  <pre><code>with open('temp.csv', 'wt') as output_write:
      csvout = csv.writer(output_write)
      csvout.writerow(country)
      output_write.close()
  </code></pre>
  
  <p>However the output puts the values into a row rather than a column in csv. Can someone please let me know how to change it?</p>
  
  <p>Thanks in advance!</p>
  
  <hr>
  
  <p>I followed some of the suggestions below and the output has empty lines between rows:</p>
  
  <p><a href="https://i.stack.imgur.com/pR55J.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pR55J.jpg" alt="enter image description here"></a></p>
  
  <p>The code I used:</p>
  
  <pre><code>import csv
  country = ['Togo', 'Nauru', 'Palestine, State of', 'Malawi']
  with open('temp.csv', 'wt') as output_write:
      csvout = csv.writer(output_write)
      for item in country:
          csvout.writerow((item, ))
  </code></pre>
  
  <hr>
  
  <p>Update:</p>
  
  <p>I figured the reason that I'm getting an empty line because each row is because windows interpret a new line differently. The code that finally work for me is:</p>
  
  <pre><code>import csv
  country = ['Togo', 'Nauru', 'Palestine, State of', 'Malawi']
  with open('temp.csv', 'w', newline = '') as output_write:
      csvout = csv.writer(output_write)
      for item in country:
          csvout.writerow((item, ))
  </code></pre>
  
  <p>Found a related post regarding the empty row:</p>
  
  <p><a href="https://stackoverflow.com/questions/3348460/csv-file-written-with-python-has-blank-lines-between-each-row">python empty row</a></p>