我有一個Python腳本解析一個傳入的有效負載在設置一個名爲「confidence」和「id」的變量,那麼它將評估該ID是否等於sam @ sam,並且該置信度大於或等於70. 現在id等於山姆@山姆,但信心不是,它仍然會觸發!我的代碼有什麼問題!!?如果語句錯誤觸發
p = eg.event.payload[2]
p = p.split(',')
id = p[0].strip()
confidence = p[1].strip()
print confidence
url = p[2].strip()
if confidence >= 70 and id == "[email protected]":
eg.TriggerEvent("FaceRec", "Unlock Door")
else:
eg.plugins.GoogleVoice.SendSMS(u'407#####', url)
向我們展示你的'p'! :) – mishik