当前位置:Gxlcms > 数据库问题 > python 操作数据库

python 操作数据库

时间:2021-07-01 10:21:17 帮助过:29人阅读

pymysql db = pymysql.connect(localhost,root,anotherone,czx) cur = db.cursor() #插入 #cur.execute(‘insert game values (NULL,"Tom",26,90,50,500,94)‘) #更新 #cur.execute("update game set name=‘John‘ where name=‘kj‘") #查询 #cur.execute("select * from game") #删除 #cur.execute("delete from game where id = 17") ##cur.execute("select * from game")

for i in cur:
  print(i) db.close()

 

python 操作数据库

标签:

人气教程排行