I am having a very confusing time, I want to add default data to my table from a python list. However it fails every time to add the list data, but I can add hard coded data using the for loop I just don't see why it doesn't work with the list data.
this works, and updates the db:
categories=["test 1","test 2","test 3","test 4"]
cur = db.cursor()
for category in categories:
cur.execute("INSERT INTO CATEGORIES (name) VALUES ('category')")
db.commit()
cur.close()
this doesnt work:
categories=["test 1","test 2","test 3","test 4"]
cur = db.cursor()
for category in categories:
cur.execute("INSERT INTO CATEGORIES (name) VALUES (?)",category)
db.commit()
cur.close()
My CATEGORIES table has an id set to auto increment and the a name column. I am beyond confused. Would love some help?