0

我写了一条指令来使用 2 个 id 从数据库中获取频率,如下所示:

cursor = db.cursor()
cursor.execute("select freq from matrix_brown where a_id in (%s) and b_id in (%s)",b_item_id,b_after_id)
b_freq=cursor.fetchone()

但我收到了这个错误:

cursor.execute("select freq from matrix_brown where a_id in (%s) and b_id in (%s)",b_before_id,b_item_id)
TypeError: execute() takes at most 3 arguments (4 given)

请帮帮我..谢谢.. :)

4

2 回答 2

1

如果你想执行来填写你调用错误的字符串:

cursor.execute("select freq from matrix_brown where a_id in (?) and b_id in (?)", (b_item_id,b_after_id))
于 2011-04-01T18:38:05.017 回答
0
cursor.execute("select freq from matrix_brown where a_id in (%s) and b_id in (%s)",(b_item_id,b_after_id))
于 2011-04-01T18:41:06.770 回答