I always got this error when I trying to run my python script:
c.execute("INSERT INTO test (word) VALUES (?)", (word)) sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 1, and there are 4 supplied.
Any idea what is the problem?
import itertools, time, sqlite3
def main():
try:
print ("Still running, please wait...")
start_time = time.time()
con = sqlite3.connect("dictionary.db")
c = con.cursor()
c.execute("CREATE TABLE test (string char(10))")
for word in itertools.imap(''.join, itertools.product('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@&#!*', repeat=4)):
c.execute("INSERT INTO test (word) VALUES (?)", (word))
con.commit()
finally:
print ("Done! Check the txt file!\n")
end_time = time.time()
print "Processing time was: ", end_time - start_time
if __name__ == "__main__": main()