我正在努力使这两行正常运行。
campaignName = result['campaign_name']
db_conn.execute('INSERT INTO Report (CAMPAIGN) VALUES ("' + campaignName + '")')
我以为“ result ['campaign_name']”中的“'”是问题,但是即使我分配了变量,该错误仍然存在。
错误:
谢谢
编辑:我已将请求修改为:
db_conn.execute("INSERT INTO Report (CAMPAIGN) VALUES ('" + str(campaignName.encode()) + "')")
答案 0 :(得分:0)
我这样解决了这个问题:
db_conn.execute("INSERT INTO Report (CAMPAIGN) VALUES (?)", (campaignName,))