check if multiple characters is in string python code example
Example 1: 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]
Example 2: how to tell if two numbers have the same characters python
sorted(str1) == sorted(str2)