title: Python and SQLite: insert into table
body: <p>I have a list that has 3 rows each representing a table row:</p>
  
  <pre><code>&gt;&gt;&gt; print list
  [laks,444,M]
  [kam,445,M]
  [kam,445,M]
  </code></pre>
  
  <p>How to insert this list into a table?</p>
  
  <p>My table structure is:</p>
  
  <pre>
  tablename(name varchar[100], age int, sex char[1])
  </pre>
  
  <p>Or should I use something other than list?</p>
  
  <p>Here is the actual code part:</p>
  
  <pre><code>    for record in self.server:
          print "---&gt;",record
          t=record
          self.cursor.execute("insert into server(server) values (?)",(t[0],));
          self.cursor.execute("insert into server(id) values (?)",(t[1],))
          self.cursor.execute("insert into server(status) values (?)",(t[2],));
  </code></pre>
  
  <p>Inserting the three fields separately works, but using a single line like</p>
  
  <p><code>self.cursor.execute("insert into server(server,c_id,status) values (?,?,?)",(t[0],),(t[1],),(t[2],))</code></p>
  
  <p>or</p>
  
  <p><code>self.cursor.execute("insert into server(server,c_id,status) values (?,?,?)",(t),)</code></p>
  
  <p>does not.</p>