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

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

返回多個(gè)項(xiàng)目

返回多個(gè)項(xiàng)目

嗶嗶one 2021-08-05 10:18:53
事實(shí)上,我是 Python 新手,這是我的第一個(gè) Python 項(xiàng)目。我正在使用 ebaysdk 在 ebay 上搜索電子產(chǎn)品,我希望它返回多個(gè)結(jié)果,因?yàn)槲业膽?yīng)用程序用于比較價(jià)格但它只返回一個(gè)結(jié)果。有人請(qǐng)幫助我使代碼返回多個(gè)結(jié)果。這是我的代碼片段。@app.route('/ebay_page_post', methods=['GET', 'POST'])def ebay_page_post():    if request.method == 'POST':        #Get json format of the text sent by Ajax        search = request.json['search']        try:            #ebaysdk code starts here            api = finding(appid='JohnOkek-hybridse-PRD-5c2330105-9bbb62f2', config_file = None)            api_request = {'keywords':search, 'outputSelector': 'SellerInfo', 'categoryId': '293'}            response = api.execute('findItemsAdvanced', api_request)            soup = BeautifulSoup(response.content, 'lxml')            totalentries = int(soup.find('totalentries').text)            items = soup.find_all('item')            for item in items:                cat = item.categoryname.string.lower()                title = item.title.string.lower().strip()                price = int(round(float(item.currentprice.string)))                url = item.viewitemurl.string.lower()                seller = item.sellerusername.text.lower()                listingtype = item.listingtype.string.lower()                condition = item.conditiondisplayname.string.lower()                print ('____________________________________________________________')                #return json format of the result for Ajax processing                return jsonify(cat + '|' + title + '|' + str(price) + '|' + url + '|' + seller + '|' + listingtype + '|' + condition)        except ConnectionError as e:            return jsonify(e)
查看完整描述

3 回答

?
慕尼黑的夜晚無(wú)繁華

TA貢獻(xiàn)1864條經(jīng)驗(yàn) 獲得超6個(gè)贊

找到第一個(gè)項(xiàng)目后,將其添加到集合中。在 for 循環(huán)完成后,返回集合。

現(xiàn)在,一旦您找到第一個(gè),您就會(huì)返回(打破迭代)


查看完整回答
反對(duì) 回復(fù) 2021-08-05
  • 3 回答
  • 0 關(guān)注
  • 123 瀏覽
慕課專欄
更多

添加回答

舉報(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)