Thursday, February 13, 2020

how to insert the data into mysql using python

import pymysql

conn=pymysql.connect(host="localhost",user="root",password="",db="my_python")
mycursor=conn.cursor()
mycursor.execute("INSERT INTO names(id,name) VALUES(1,'ANIL');")
print("->data inserted")

conn.commit()
conn.close()

output:




No comments:

Post a Comment

python class topic video