首页 > 数据库技术 > 详细

python 操作数据库

时间:2016-10-12 22:44:15      阅读:173      评论:0      收藏:0      [点我收藏+]
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()

 

python 操作数据库

原文:http://www.cnblogs.com/wumac/p/5954318.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!