###System###
- Python 2.7
- SQLite3
###Info###
I have table with the following structure:
c.execute("CREATE TABLE foo (id INTEGER, number INTEGER, number2 REAL, letters TEXT)")
I got the following list
list_foo = [9, 1, 2.3, 'abc']
In the table I already have fields, so the table should in this case be updated where id=9
###Question###
How do I update a row with my list variable?
###Solution idea###
c.execute("UPDATE foo SET VALUES = ? WERE id = ?", (list, list[0]))
But of course VALUES doesn't work. How do I instantly update the row without typing:
c.execute("UPDATE foo SET id = ?, number = ?, number2 = ?, letters = ? WERE id = ?", (list_foo[1], list_foo[2], list_foo[3], list_foo[0]))
My actual table has more entries than this, so it would be a pain to type it like this.
###stackoverflow##
h ttp://stackoverflow.com/questions/30194417/sqlite3-python-update-whole-row-with-a-list
###Edit###
If it's not possible and I have to use my long SQLite3 code, is it at least possible to have:
(list_foo[1:], list_foo[0])
instead of
(list_foo[1], list_foo[2], list_foo[3], list[0]))