title: How can I export my scraped data from a list to my csv file?
body: <p>I can't seem to correctly export my data into a single variable an export this variable to a csv file. What am I doing wrong?</p>
  
  <p>I tried:</p>
  
  <pre class="lang-py prettyprint-override"><code>csvFile = open('products.csv', 'w')
  writer = csv.writer(csvFile)
  writer.writerow(('name', 'price'))
  
  url = 'https://www.ah.nl/producten/aardappel-groente-fruit/groente/merk=AH'
  driver = webdriver.Chrome()
  driver.get(url)
  driver.implicitly_wait(100)
  
  def itemGrabber(url):
      items = driver.find_elements_by_class_name('product')
      print(str(len(items)) + " items found on page.")
  
      item = []
      for i in items:
          ## name of product
          t = i.find_element_by_class_name('product-description__title').text.replace("\xad", "")
  
          ## price
          p = i.find_element_by_class_name('product-price').text
  
          item.append(t)
  
          item.append(p)
  
  
      print(item)
  
      return item
  
  products = itemGrabber(url)
  writer.writerow(products)
  
  csvFile.close()
  </code></pre>
  
  <p>the result in the csv is:</p>
  
  <pre><code>name,price
  
  yoghurt,1.0,banana,2.0,kinkytoy,6.99
  </code></pre>
  
  <p>And I want it to be categorized correctly. I tried converting t and p to lists and adding them to the variable 'item', but this is even worse. Can you give me tips how to make it better? Thanks for your patience.</p>