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()

 

posted @ 2016-10-12 20:26  疯陈演义  阅读(204)  评论(0编辑  收藏  举报