# Basic syntax:
any(elem in your_string for elem in elements)
# Where:
# - elements is an iterable
# - any() will return true if any of the elements in elements is in
# your_string, otherwise it returns False
# Example usage:
your_string = 'a short example string'
any(elem in your_string for elem in ['Malarkey', 23, 'amp'])
--> True # any() returns True because amp is in your_string
>>> string = "Hello World"
>>> # Check Sub-String in String
>>> "World" in string
True
>>> # Check Sub-String not in String
>>> "World" not in string
False
myString = "<text contains this>"
myOtherString = "AnotherString"
# Casting to string is not needed but it's good practice
# to check for errors
if str(myString) in str(myOtherString):
# Do Something
else:
# myOtherString didn't contain myString