Docy

pymysql delete dynamic

Estimated reading: 1 minute 854 views

Python Delete Dynamic Operation

The Below Example is for Delete Dynamic operation.

				
					import pymysql


conn = pymysql.connect(
        host='localhost',
        user='root',
        password="12345",
        db='sakila',
)
get_id = int(input("enter the id"))
cur = conn.cursor()
q1 = "delete from student where id = %s"
cur.execute(q1,get_id)
conn.commit()
print("record deleted sucessfully")
conn.close()
				
			

Leave a Comment

Share this Doc
CONTENTS