Does Python have a string 'contains' substring method?

contains, python, string, substring

Solution

Use the `in` operator:

if "blah" not in somestring: 
    continue

Note: This is case-sensitive.

Problem

I'm looking for a `string.contains` or `string.indexof` method in Python. I want to do: ``` if not somestring.contains("blah"): continue ```

Original source

Related problems