0

This is a bank management system. where acc_id the account I want to delete from a MySQL Table BANK I have already connected python to mysql but this code dosen't work. Is there any alternative to .format ?

if choice == 2:
    acc_id = int(input("ENTER ACCOUNT NUMBER TO DELETE:"))
    cursor = mydb.cursor()
    cmd2 = "DELETE FROM BANK WHERE ACC_NO = {}".format(acc_id)
    cursor.execute(cmd2)
snakecharmerb
  • 47,570
  • 11
  • 100
  • 153

1 Answers1

1
user_input = raw_input("Required Data")

cursor.execute("DELETE FROM BANK WHERE ACC_NO = %s", (user_input))

Hopefully, this will help you to solve your problem.