0

I am using the below code to delete a row from sqlite table.

def deleteFromTable(item):
    conn = sqlite3.connect("lite.db")
    cur = conn.cursor()
    cur.execute("DELETE FROM store WHERE item=?", (item,))
    conn.commit()
    conn.close()

Why do i need to use comma after item (item,) while passing the argument?

1 Answer 1

1

('String') evaluates into string, but ('string',) evaluates into tuple. that's why you need comma.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you very much

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.