Check If String Contains Word in Python Tutorial Example
Hi Dev,
Today our leading topic is checked if the string contains the word in the Python tutorial example. We will look at an example of a Python check string containing words. Step by step explain Python if the string contains the word. I would like to share with you the Python check string contains.
In this example, we will use In Operator to check string contains a word or not. we will take the "myString" variable with some string and then we will check the "findString" variable to check that words exist not in the string. let's see a simple example.
Example :
main.py
myString = "This is ItSolutionStuff.com"
findString = "Solution"
# Python check string contains word
if findString in myString:
print("Found!")
else:
print("Not found!")
Output:
Found!
- Get Last 2 Digits of Number in Python Tutorial Example
- How to Sum of First and Last Digit of Number in Python?
- How to Get First and Last Digit of Number in Python?
- Get the Last Digit of Number in Python Tutorial Example
- Get the First Digit of Number in Python Tutorial Example
- How to Remove All Decimals from Number in Python?
- How to Convert String to Float with 2 Decimal Places in Python?
- How to Format Number to 2 Decimal Places in Python?