|
|
|
#-*- encoding: gb2312 -*-import os, sys, stringimport MySQLdbtry: conn = MySQLdb.connect(host='localhost',user='root',passwd='root',db='zftest')except Exception, e: print e sys.exit()cursor = conn.cursor()sql = "INSERT INTO album (artist,title,created,updated) VALUES ('77','mytest','hongfu demo','2007-07-09')";sql = "update album set title = '9999999999' where id = 44"#sql = 'delete from album where id = 41'#print sql cursor.execute(sql)conn.commit()sql = "select * from album"cursor.execute(sql)datas = cursor.fetchone()#datas = cursor.fetchall()print datas#for s in datas:# print s[1] + '++++++' + s[2] + '+++++++' + s[3] |
|