The Pythonic way to check if a string x is a substring of y is:
if x in y:
Finding if x is equivalent to a, b, c, d, e, f or g is also Pythonic:
if x in [a,b,c,d,e,f,g]:
But checking if some string x contains either a, b, c, d, e, f or g seems clunky:
if a in x or b in x or c in x or d in x or e in x or f in x or g in x
Is there a more Pythonic method of checking if a string x contains an element of a list?
I know it is trivial to write this myself using a loop or using a regex:
re.search('(dog|cat|bird|mouse|elephant|pig|cow)', x)
but I was wondering if there was a cleaner way that does not involve regex.
 
     
     
     
     
    