Python Language String Methods String Contains

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Example

Python makes it extremely intuitive to check if a string contains a given substring. Just use the in operator:

>>> "foo" in "foo.baz.bar"
True

Note: testing an empty string will always result in True:

>>> "" in "test"
True


Got any Python Language Question?