0

I want something like this. But the following does not work The tablename is saved in e, the name of the row in i[0] and the value in k.

"INSERT INTO ? (?) VALUES(?)" (e, i[0], k)

2
  • You can't use placeholders for table and column names. You have to use string formatting functions for that, then you can use the result in a prepared statement. Commented Jul 14, 2017 at 16:46
  • "INSERT INTO {} ({}) VALUES(?)".format(i[e], i[0]), (k) I tried it this way but it didn't work Commented Jul 14, 2017 at 17:00

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.