◐ Shell
clean mode source ↗

Python Language Tutorial => String Contains

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?

pdf PDF - Download Python Language for free



Previous Next