亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

我無法在 Zapier 的 python 代碼中獲得輸出

我無法在 Zapier 的 python 代碼中獲得輸出

qq_遁去的一_1 2022-06-22 17:04:59
我一直在使用 python 閱讀 Zapier 文檔,他們展示了這個例子:output= {'has_lunch': False}if input.get('body') and 'lunch' in input['body']:        output['has_lunch'] = True實際上,這看起來像是我正在尋找的東西,示例和我的代碼之間的主要區別是我想傳遞多個參數并評估這些參數以獲取特定的輸出。例如:output= {'Mango': 1, 'Apple': 2}if input.get('Fruits') and 'Mango' in input['Fruits']:        output['Mango'] =  1elif input.get('Fruits') and 'Apple' in input['Fruits']:        output['Apple'] =  2錯誤:輸出丟失請定義輸出或提前返回。
查看完整描述

1 回答

?
HUH函數

TA貢獻1836條經驗 獲得超4個贊

我認為這是你需要的:


if input.get('Fruits') and 'Mango' in input['Fruits']:

        mango = 1

else: mango = None


if input.get('Fruits') and 'Apple' in input['Fruits']:

        apple = 2

else: apple = None       

output = {'mango': mango, 'apple': apple}

它說Error: output missing Please define output or return early由于zapier的設置方式。在 JS 中,您可以執行output或執行 if/else 并執行return. 我不是 Python 方面的專家,但您需要使用returnJS 中的等價物才能使您的代碼工作,否則它會在到達第一個output.


查看完整回答
反對 回復 2022-06-22
  • 1 回答
  • 0 關注
  • 110 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號