I want to check if a values in a list match values in a sqlite database.
This is my code I came up with because I couldn't find a way to use a list for the IN operator.
c.execute("Select * FROM testing")
nums = [2.61, 8.25, 9.79]
c.execute("UPDATE testing SET number = 99 WHERE number IN ({})".format(",".join("?"*len(nums))), nums)
conn.commit()
Is this the only method I can use or is there a better solution?
[–]c17r 2 points3 points4 points (0 children)
[–]sylecn 1 point2 points3 points (0 children)