這個函數應該檢查用戶在提示後輸入的成分。當我在sqlite中嘗試這個查詢語句時(當然沒有用戶輸入)它可以工作。在Python中它說有一個錯誤!sqlite3「OperationalError:near」)「:syntax error」python
def checkIngredient():
usrIngredient = input("\nEnter an ingredient that you would like to make a drink with: \n\n")
query = c.execute("SELECT DRDESC FROM Drinks WHERE DRDRID IN "
"(SELECT DTDRID FROM Detail WHERE INGID ="
"(SELECT INGID FROM Ingredients WHERE INDESC LIKE))", (usrIngredient,))
resultset = c.fetchall()
for result in resultset:
if resultset is not None:
print(result)
else:
print("Sorry, there are no drinks with that ingredient")
你能後整個錯誤消息?那是蟒蛇抱怨或SQL? – tdelaney