I have a python list, say l
l = [1,5,8]
I want to write a sql query to get the data for all the elements of the list, say
s
Dont complicate it, Solution for this is simple.
l = [1,5,8] l = tuple(l) params = {'l': l} cursor.execute('SELECT * FROM table where id in %(l)s',params)
I hope this helped !!!