Another way to check for a substring is by using the find() method. This method searches the string and returns the index of the first occurrence of the substring. If the substring isn’t found, it returns -1.
For those looking for an alternative to the in operator, Python’s __contains__() method (invoked using the contains() function) can be used. This method is essentially an internal operator for checking membership and is typically used for classes, but it can also be employed directly for string operations.