scholar_no = int(input('Enter the Scholar Number'))
mycursor.execute("delete from student1 WHERE Scholar_No = %s", (scholar_no))
mydb1.commit()
最佳答案
您必须添加一个元组而不是单个变量,即使它只是单个值
mycursor.execute("delete from student1 WHERE Scholar_No = %s", (scholar_no,))
关于python - 我的代码显示了不正确的mysql语法,尽管它是正确的,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/65169710/