I’m working with Python, and I’m trying to find out if you can tell if a word is in a string.

I have found some information about identifying if the word is in the string – using .find, but is there a way to do an if statement. I would like to have something like the following:

if string.find(word):
    print("success")

14 Answers
14

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *