我对Python很陌生。我从continuum安装了anaconda,从Pypi安装了MySQLdb。我正努力在spyder中运行这段代码。在
import MySQLdb
class db_class:
def __init__(self,db):
self.Mdb = MySQLdb.connect(host='localhost',
user='root',
passwd='',
db=db)
self.Mcursor = self.Mdb.cursor()
def __del__self(self):
self.Mcursor.close()
self.Mdb.close()
def execute(self,Aquery):
return self.Mcursor.execute(Aquery)
def fetchall(self):
return self.Mcursor.fetchall()
def fetchone(self):
return self.Mcursor.fetchone()
def description(self):
return self.Mcursor.description
if __name__=="__main__":
db=db_class('XXX')
我在ipython控制台上看到了这个:
^{pr2}$MySQL已安装在以下路径中
C:\Users\Anaconda2\Lib\site-packages\
。谢谢你的帮助。在
目前没有回答
相关问题 更多 >
编程相关推荐