以下查询似乎无法执行,并显示错误- TypeError: not THe arguments在设置字符串格式期间转换。我在哪里做错了?
cursor = connection.cursor()
cursor.execute("INSERT INTO darkweb (onionurl, sitetext) VALUES(%s, 'test') ON CONFLICT (onionurl) DO NOTHING)", (onion))
connection.commit()
cursor.close()发布于 2019-04-25 04:11:24
您需要在输入元组中添加一个逗号。
cursor = connection.cursor()
cursor.execute("INSERT INTO darkweb (onionurl, sitetext) VALUES(%s, 'test') ON CONFLICT (onionurl) DO NOTHING)", (onion,))
connection.commit()
cursor.close()或者你可以这样做:
cursor.execute("INSERT INTO darkweb (onionurl, sitetext) VALUES(%s, 'test') ON CONFLICT (onionurl) DO NOTHING)", [onion])https://stackoverflow.com/questions/55820079
复制相似问题