Skip to content

String contains equivalent in Python

In languages like C# or Java, the String class has a Contains() method to check if a certain substring is contained in the string. Python has an equivalent for this that is using the in operator:

[sc name=”src” url=”https://stackoverflow.com/questions/3437059/does-python-have-a-string-contains-substring-method” ]

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.