[Tutor] SQLite

Crusier crusier at gmail.com
Thu May 19 05:03:12 EDT 2016


Dear Alan,

I have read your web page and try to test thing out on SQLite.

Attached is my code:

import sqlite3
conn = sqlite3.connect('example1.db')
c = conn.cursor()
c.execute('drop table if exists stocks')
c.execute('''CREATE TABLE stocks
             (code text)''')

# Insert a row of data
List = ['00001', '00002', '00003', '00004', '00005', '00006', '00007',
'00008', '00009', '00010', '00011', '00012']

c.executemany('INSERT INTO stocks VALUES (?)', List)

# Save (commit) the changes
conn.commit()

# We can also close the connection if we are done with it.
# Just be sure any changes have been committed or they will be lost.
conn.close()

The following error has came out
sqlite3.ProgrammingError: Incorrect number of bindings supplied. The
current statement uses 1, and there are 5 supplied.

Please advise.

Thank you very much.

Regards,
Crusier


More information about the Tutor mailing list