我在Zapier
应用程序中的代码有问题。我已经写了一个相当简单的if, elif
,我画了不正确的输出。如果我将变量声明为or
,那么代码可以工作,但是当使用input.get
这是一个要求时,即使值是null
,代码也总是同时回答这两个问题。你知道吗
该计划的目标是确定一个项目是否有电话号码,电子邮件或两者兼有。有什么想法吗?我对Python和Zapier的代码相当陌生,所以我确信这很简单。你知道吗
phoneTest = input.get('Phone')
emailTest = input.get('Email')
if(emailTest != '') and (phoneTest != ''):
logic = 'both'
elif(emailTest == '') and (phoneTest != ''):
logic = 'phone'
elif(emailTest != '') and (phoneTest == ''):
logic = 'email'
output = [{'test': emailTest}]
Zapier中的Python代码:
您的代码专门针对空字符串进行检查,而不是null(None)。所以是的,如果项目是空的,它会说两者。尝试执行“truthy”检查,而不是专门检查空字符串。你知道吗
相关问题 更多 >
编程相关推荐