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 x
True

Leave a Comment