title: SQlite SELECT WHERE Column = list of unknown number of values
body: <p>I have a list that changes size (and values) depending on the data it gets from a different table. Is there a way to use the list as a variable in place of the <code>= (?)</code> in the execute function?</p>
  <p>I could add the number of <code>(?)</code> needed using a for loop that would add it to the command</p>
  <pre><code># some function that adds or changes value of var
  var = [1, 2, 3]
  cmd = &quot;&quot;&quot;SELECT * FROM table WHERE col IN (&quot;&quot;&quot;
  for i in range(len(var)):
      cmd += &quot;&quot;&quot;(?)&quot;&quot;&quot;
      print(cmd, i)
      if i &lt; len(var) - 1:
          cmd += &quot;&quot;&quot;, &quot;&quot;&quot;
          print(cmd, i)
      if i == len(var) - 1:
          cmd += &quot;&quot;&quot;)&quot;&quot;&quot;
          print(cmd, i)
  
  c.execute(cmd, (var))
  
  </code></pre>
  <p>is there a way for me to just input the list as a whole similar to this.</p>
  <pre><code>c.execute(&quot;&quot;&quot;SELECT * FROM table WHERE col IN (?)&quot;&quot;&quot;,
            (var))
  </code></pre>
  <p>This doesn't work due to an error 'Incorrect number of bindings supplied'. Which makes sense.</p>