使用Python对MySQL数据库进行增删查改操作
发布时间
阅读量:
阅读量
#coding=utf-8
import MySQLdb
class Mysql_Oper:
def __init__(self,host,user,passwd,db):
self.host=host
self.user=user
self.passwd=passwd
self.database=db
def db_connecet(self):
try:
#连接
conn=MySQLdb.connect(host=self.host,user=self.user,passwd=self.passwd,db=self.database,charset="utf8")
cursor = conn.cursor()
except MySQLdb.Error,e:
print "Mysql Error %d: %s" % (e.args[0], e.args[1])
def drop_table(self,table):
全部评论 (0)
还没有任何评论哟~
