import MySQLdb
conn = MySQLdb.connect(host="localhost", \ user="root", \ passwd="root", \ db="TestDB")cursor = conn.cursor()cursor.execute("select * from Users")res = cursor.fetchall()print rescursor.close()conn.close()
浙公网安备 33010602011771号