I was trying to use executemany to insert values into a database, but it just won\'t work for me. Here is a sample:
clist = []
clist.append(\"abc\")
clist.ap
Just to complement the context: In a closely related situation I meant to insert a list of poly-tuples into a table using executemany as such:
res = [("John", "2j4o1h2n"), ("Paula", "lsohvoeemsy"), ("Ben", "l8ers")]
cur.executemany("INSERT INTO users (user, password) VALUES (?)", res)
Expecting SQLite to to take one tuple at a time (hence the single ? parameter-substitution in the VALUES field) and splitting it up into its encapsulated attributes ( in this case), it failed with a sqlite3.ProgrammingError exception The current statement uses 1, and there are 2 supplied. as well, as SQLite expects separately substituted attributes in the VALUES (...) field. So this fixes it:
cur.executemany("INSERT INTO users (user, password) VALUES (?, ?)", res)
This is a trivial case but might confuse a little, I hope it might help whoever's stuck.