【发布时间】:2014-07-01 06:00:16
【问题描述】:
抱歉,如果您认为是转发,代码非常简单,我怀疑这里也是一个微不足道的错误,但无法继续前进:
import whois
import MySQLdb
db = MySQLdb.connect(host="localhost", user="root", passwd="pass", db="whois")
cur = db.cursor()
wi = whois.whois("google.com")
cur.execute("""INSERT INTO wrec (dname, wfull, dns) VALUES (%s, %s, %s)""") , (wi.domain_name, wi.text, wi.name_servers)
结束于:
_mysql_exceptions.ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%s, %s, %s)' at line 1")
如前所述,怀疑是微不足道的错误。有什么建议?提前非常感谢
【问题讨论】:
-
这是一个字符串插值问题。
%s不会被变量替换。
标签: python mysql-python pywhois