SQLite-Python "executemany()" not executing to the database
<p>I need to get this program to store the values for a persons firstname and surname in a database. The database is called Class and the table inside it that I am trying to insert data into is called Names. 
I have tried to rearrange this several times and removed it from its try loop to try diagnose the issue. Thanks in advance. I will help the best I can :)</p>

<pre><code>new_first,new_surname = str(input("Firstname:\t")), str(input("Surname:\t"))
new_name = [new_surname, new_first]
print(new_name)
c.executemany("INSERT INTO Names VALUES (?,?)", new_name)
</code></pre>

<p>The error message I keep getting is:
Incorrect number of bindings supplied. The current statement uses 2, and there are 7 supplied.</p>

<p><code>executemany()</code> expects <em>many</em> items, as the name suggests.</p>

<p>That means a list of lists, or any similar data structure. You give it only one item.</p>

<pre><code>new_first, new_surname = str(input("Firstname:\t")), str(input("Surname:\t"))
new_name = [[new_surname, new_first]]

c.executemany("INSERT INTO Names VALUES (?,?)", new_name)
</code></pre>

<p>or use <code>execute</code> if you only have one item</p>

<pre><code>new_first, new_surname = str(input("Firstname:\t")), str(input("Surname:\t"))
new_name = [new_surname, new_first]

c.execute("INSERT INTO Names VALUES (?,?)", new_name)
</code></pre>

python sqlite