Possible Duplicate:
Check if multiple strings exist in another string
I can't seem to find an equivalent of code that functions like this anywhere for Python:
Basically, I'd like to check a string for substrings contained in a list.
Possible Duplicate:
Check if multiple strings exist in another string
I can't seem to find an equivalent of code that functions like this anywhere for Python:
Basically, I'd like to check a string for substrings contained in a list.
Try this test:
It will return
True
if any of the substrings insubstring_list
is contained instring
.Note that there is a Python analogue of Marc Gravell's answer in the linked question:
Probably the above version using a generator expression is clearer though.