python 操作数据库

import 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()
原文地址:https://www.cnblogs.com/wumac/p/5954318.html