S
S
sdfg sdfg2016-07-28 05:47:46
Python
sdfg sdfg, 2016-07-28 05:47:46

How to insert variable into sqlite3 Python string?

I have a realtime variable - this is the current time, I need the realtime variable to be inserted into the table! here is the script line
cur.execute('INSERT INTO images (id, image_src) VALUES(NULL, 'realtime')')
when I compile it, the word realtime is simply written into the line, and I need the variable to fit

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2016-07-28
@maratARMENIA

cur.execute("INSERT INTO images (id, image_src) VALUES(NULL, ?)", realtime)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question