第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

帶有sqlachemy的燒瓶中的AttributeError

帶有sqlachemy的燒瓶中的AttributeError

不負(fù)相思意 2021-06-24 18:35:23
我是flask和python的新手當(dāng)我嘗試使用“LIKE %s”從我的flask應(yīng)用程序中的數(shù)據(jù)庫(kù)中檢索時(shí),我得到AttributeError(“‘list’對(duì)象沒有屬性‘keys’”,)但如果我使用占位符“ title =:result" 我將只檢索一行,但我不能使用 LIKE 子句我只能檢索我在數(shù)據(jù)庫(kù)中的確切數(shù)據(jù)不知道如何解決我手頭的問題,任何幫助都會(huì)受到高度贊賞。應(yīng)用程序.py@app.route("/search",methods=['GET', 'POST'])def search():      if request.method=='GET':       return render_template("search.html")       #search=request.form.get['search']    else:        try:            res =request.form.get('search')            likeString = "'%%"+res+"%%'"            if likeString!="":                #return (res)                results=db.execute('''SELECT title FROM books WHERE title LIKE %s;''', likeString).fetchall()                #results=db.execute("SELECT title FROM books WHERE title =:result",                #{"result": res}).fetchall()                if results is None:                   return render_template("error.html", message="No such book")                else:                   return render_template("search.html",results=results)            else:                return ("you didn't enter a search value")        except Exception as e:                raise ValueError ("could not retrieve from database",e)如果我能得到任何幫助,我將不勝感激。提前致謝!
查看完整描述

2 回答

  • 2 回答
  • 0 關(guān)注
  • 162 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)