title: How to export sqlite to CSV in Python without being formatted as a list?
body: <p>Here is what I currently have:</p>
  
  <pre><code>conn = sqlite3.connect(dbfile)
  conn.text_factory = str ## my current (failed) attempt to resolve this
  cur = conn.cursor()
  data = cur.execute("SELECT * FROM mytable")
  
  f = open('output.csv', 'w')
  print &gt;&gt; f, "Column1, Column2, Column3, Etc."
  for row in data:
    print &gt;&gt; f, row
  f.close()
  </code></pre>
  
  <p>It creates a CSV file with output that looks like this:</p>
  
  <pre><code>Column1, Column2, Column3, Etc.
  (1, u'2011-05-05 23:42:29',298776684,1448052234,463564768,-1130996322, None, u'2011-05-06 04:44:41')
  </code></pre>
  
  <p>I don't want the rows to be in parentheses nor have quotes nor the 'u' before strings. How do I get it to write the rows to csv without all of this? Thanks,</p>