Use the ‘in’ keyword to check if string contains substring in python.  

# Let's creat a string
str1 = 'We will learn Data Science'
str2 = 'Data Science'
str3 = 'I will'

# We want to check if str1 contains str2
if str2 in str1:
    print('Yes str1 contains str2')

# Now let's check if str1 contains str3
if str3 in str1:
    print('Yes str1 contains str3')
    print('No str1 does not contain str3')
Yes str1 contains str2
No str1 does not contain str3

That's how we Check if string contains substring.

That’s all for this mini tutorial. To sum it up, we learned how to Check if string contains substring. 

Hope it was easy, cool and simple to follow. Now it’s on you.