title: python list to csv file with each item in new line
body: <p>I am trying to write a function that takes in a list of strings and writes each String in the list as a separate row in a csv file, but I am not getting any output. Could you please help me understand what I am doing wrong. Here is my code:</p>
  
  <pre><code> import sys 
   import os
   import csv
  
   list= ['name@domain.com', 'name@domain.com', 'name@domain.com', 'name@domain.com', 'name@domain.com', 'name@domain.com']
  
   def write_to_csv(list_of_emails):
       with open('emails.csv', 'w', newline='') as csvfile:
           writer = csv.writer(csvfile, delimiter = ',')
           writer.writerows(list_of_emails)
  
  write_to_csv(list)  
  </code></pre>