if "needle" in haystack:
print ('haystack.__contains__("needle")')
Is probably the obvious/canonical answer to the question of trying to find a substring.So obvious that -to be fair- I blanked for a moment too. But 'in' is an operator, not a method (even though it calls __contains__ under the hood) . The question might have been slightly malformed?