How do I check if a given Python string is a substring of another one? [duplicate] How do I check if a given Python string is a substring of another one? [duplicate] python python

How do I check if a given Python string is a substring of another one? [duplicate]


Try using in like this:

>>> x = 'hello'>>> y = 'll'>>> y in xTrue


Try

isSubstring = first in theOther


string.find("substring") will help you. This function returns -1 when there is no substring.


matomo