import MySQLdb conn=MySQLdb.connect(host='127.0.0.1',user='root',passwd='123456',db='08day5') cur=conn.cursor() #打開數(shù)據(jù)庫(kù) #提取數(shù)據(jù) reCount=cur.execute('select * from admin') data =cur.fetchall() print reCount print data #關(guān)閉數(shù)據(jù) cur.close() conn.close()