【发布时间】:2012-12-06 11:26:50
【问题描述】:
我的脚本中有一个函数将值传递给一个类方法,该方法的工作是用它接收到的变量填充其分配的数据库。问题是,我不确定语法是否正确,因为我没有使用普通字符串。方法如下。
def new_response(self, link_pattern, link, response, ref_id=""):
self.db_cursor.execute('''INSERT INTO tb_memory VALUES
(%s, %s, %s, %s)''' % (ref_id, link_pattern, link, response))
什么是最合适的句法方法?
【问题讨论】:
标签: python string sqlite python-2.7