title: Python skips line when printing to CSV
body: <p>I am trying to create .csv file.</p>
  
  <p>For some reason it skips line before printing entry.</p>
  
  <p>Here is the output</p>
  
  <p><a href="https://i.stack.imgur.com/GPfi7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GPfi7.png" alt="enter image description here"></a></p>
  
  <p>But here is what I need</p>
  
  <p><a href="https://i.stack.imgur.com/Vskx4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Vskx4.png" alt="enter image description here"></a></p>
  
  <p>Below is code. Apparently <code>if line != "":</code> doesn't work</p>
  
  <pre><code>import csv
  
  #-----------------------------------
  def csv_writer(data,path):
      """
      Write data to a CSV file path
      """
      with open(path, "w") as csv_file:
          writer = csv.writer(csv_file, delimiter=',')
          for line in data:
              if line != "":
                  writer.writerow(line)
  
  #-----------------------------------
  if __name__ == "__main__":
      data = ["first_name,last_name,city".split(","),
              "Tyrese,Hirthe,Strackeport".split(","),
              "Jules,Dicki,Lake Nickolasville".split(","),
              "Dedric,Medhurst,Stiedemannberg".split(",")
              ]
      path = "output.csv"
      csv_writer(data,path)
  </code></pre>