复制代码 代码如下:
import MySQLdb
try:
conn=MySQLdb.connect(host='localhost',user='root',passwd='root',db='test',port=3306)
cur=conn.cursor()
cur.execute('select * from user')
cur.close()
conn.close()
except MySQLdb.Error,e:
print "Mysql Error %d: %s" % (e.args[0], e.args[1])
Copyright© 2013-2020
All Rights Reserved 京ICP备2023019179号-8