2011-04-01 42 views
0

我已經寫來從使用2級的數據庫頻率的指令,如下圖所示:錯誤MySQL查詢使用python腳本

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) 

PLS幫我.. 謝謝.. :)

回答

1

如果你想execute填寫您的調用是錯誤的字符串:

cursor.execute("select freq from matrix_brown where a_id in (?) and b_id in (?)", (b_item_id,b_after_id)) 
+0

很高興能幫到你!如果這解決了你的問題,請接受答案。 :) – AlG 2011-04-01 19:37:18

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