django - Python IF conditions -
i'm new django python if makes me feel confused. please me!
im trying make if condition facebook chat bot api. whole function when user sends in facebook chat, bot remove punctuations, lower case text , split based on space. after pick joke json list keyword got. quick reply 2 buttons "yes" , "no" sent user joke.
it checks if keyword absent. want when user types "no" in chat, bot send "then not". did wrong here?
strong texttokens = re.sub(r"[^a-za-z0-9\s]", ' ', recevied_message).lower().split() joke_text = '' token in tokens: if token in jokes: joke_text = random.choice(jokes[token]) .... code send_message(fbid, joke_text) quick_text = "do want joke? " send_quick_reply_message(fbid, quick_text) break if not joke_text: joke_text = "i didn't understand! " \ "send 'stupid', 'fat', 'dumb' yo mama joke!" send_message(fbid, joke_text) if 'no': joke_text = "then not" send_message(fbid, joke_text)
if 'no':
is true, want checking if == 'no'?
Comments
Post a Comment