hostname = raw_input("Enter hostname : ")
connection = MySQLdb.connect (host = "localhost", user = "hawkhost_databas", passwd = "}MFkdDI6]#QX", db = "hawkhost_database")
cursor = connection.cursor ()
cursor.execute ("select User, Hostname, Password, Port from dbinfo where hostname=%s", (hostname))
答案 0 :(得分:-1)
cursor.execute(“从dbinfo中选择用户,主机名,密码,端口,其中Hostname ='%s'”%d)
这解决了问题