vendredi 28 juillet 2017

Multiple Substrings in String - Python [duplicate]

Why wouldn't this code return "true" if any of the substrings are located in the larger someString?

substring1 = "foo"
substring2 = "text"
someString = "texting"

if ((substring1 or substring2) in someString):
    print "true"

I've looked into the any() function but I don't think it's what I'm looking for.

Aucun commentaire:

Enregistrer un commentaire