How to Check If String Contains Word in Python?

By Hardik Savani October 30, 2023 Category : Python

Hi Friends,

In this example, you will learn python check string contains word. I would like to share with you python if string contains word. if you want to see an example of python check string contains then you are in the right place. It is a simple example of how to check if string contains word in python.

In this example, we will use In Operator to check string contains word or not. we will take "myString" variable with some string and then we will check "findString" variable to check that words exist on not in string. let's see a simple example.

You can use these examples with python3 (Python 3) version.

let's see below a simple example with output:

Example 1:

myString = "This is"
findString = "Solution"
# Python check string contains word
if findString in myString:
    print("Not found!")



I hope it can help you...

Tags :