lundi 28 décembre 2015

Multiple if are not working in python

I have this code:

Split = Message.Body.split()
    split = Split

    if 'a' or 'b' or 'b' in split:
        time.sleep(2)
        print '1'
    elif 'c' or 'd' in split:
        time.sleep(2)
        print '2'
    elif 'e' or 'f' in split:
        time.sleep(2)
        print '3'           
    else:
        time.sleep(2)
        print '4'

I have used split to separate the words from my message and I want if a certain message is received to print a certain word, but now it only prints 1 regardless of the input.

Aucun commentaire:

Enregistrer un commentaire