Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

check if multiple characters is in string python

def containsAny(str, set):
    """ Check whether sequence str contains ANY of the items in set. """
    return 1 in [c in str for c in set]

def containsAll(str, set):
    """ Check whether sequence str contains ALL of the items in set. """
    return 0 not in [c in str for c in set]
Source by www.oreilly.com #
 
PREVIOUS NEXT
Tagged: #check #multiple #characters #string #python
ADD COMMENT
Topic
Name
1+5 =