Answers for "python see if string contains any of the following"

4

python check if string contains substring

string = "My favourite programming language is Python"
substring = "Python"

if substring in string:
    print("Python is my favorite language")
elif substring not in string:
    print("Python is not my favourite language")
Posted by: Guest on January-17-2021

Code answers related to "python see if string contains any of the following"

Python Answers by Framework

Browse Popular Code Answers by Language