How to Check If String Contains Word in Python?
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:
myString = "This is ItSolutionStuff.com" findString = "Solution" # Python check string contains word if findString in myString: print("Found!") else: print("Not found!")
I hope it can help you...
We are Recommending you
- How to Generate Random String in Python?
- Python Remove Character from List of Strings Example
- Python Generate List of Random Strings Example
- How to Remove All String Values from List in Python?
- How to Get Only String from a List in Python?
- Python Convert List to String with Space Example
- Python String Replace Space with Comma Example
- Python String Replace Space with Dash Example
- Python String Replace Tab with Space Example
- Python String Replace Double Quotes with Single Quotes Example
- Python String Replace All Numbers Example
- Python Replace First Character Occurrence in String Example
- Python Replace Last Occurrence in String Example