title: python sqlite3 insert list
body: <p>I have a python script that should insert a list into a sqlite table. It appears my insert statement is not working. </p>
  
  <pre><code>links = ['a', 'b', 'c']
  
  conn = sqlite3.connect('example.db')
  
  #create a data structure
  c = conn.cursor()
  
  #Create table
  c.execute('''Create TABLE if not exists server("sites")''')
  
  #Insert links into table
  def data_entry():
      sites = links
      c.execute("INSERT INTO server(sites) VALUES(?)", (sites))
      conn.commit()
  
  #query database
  c.execute("SELECT * FROM server")
  rows = c.fetchall()
  for row in rows:
      print(row)
  
  conn.close
  </code></pre>
  
  <p>I checked the database at command line but the "server" table is empty:</p>
  
  <pre><code>C:\App\sqlite\sqlite_databases&gt;sqlite3
  SQLite version 3.17.0 2017-02-13 16:02:40
  Enter ".help" for usage hints.
  Connected to a transient in-memory database.
  Use ".open FILENAME" to reopen on a persistent database.
  sqlite&gt; .tables
  server
  sqlite&gt; SELECT * FROM server
  ...&gt; ;
  sqlite&gt;
  </code></pre>
  
  <p>So it doesn't appear that the list is actually being inserted.</p>