'Checking List within String (python) [duplicate]

I know you can check if a word matches a word list

fruit = 'bananas'
fruitList = ('apples', 'bananas', 'cherries')

if fruit in fruitList:
  do something

Is there a similar way to do it backwards? To find if a word in a list is contained in a string?

fruitString = 'I like bananas'
fruitList = ('apples', 'bananas', 'cherries')

if fruitList in fruitString:
  do something

I know I can check using a loop:

for fruit in fruitList:
  if fruit in fruitString:
    do something

But I was wondering if there was a cool one-line pythonic comparison. I've tried something like any(f in fruitList for f in fruitString) but my python-fu is weak.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source