Chrome Extension

Python - String , Check If Word Is In string

if word in mystring: 
   print ('success')


# or


if 'seek' in 'those who seek shall find':
    print('Success!')
Best JSON Validator, JSON Tree Viewer, JSON Beautifier at same place. Check how cool is the tool

but keep in mind that this matches a sequence of characters, not necessarily a whole word - for example, 'word' in 'swordsmith' is True. If you only want to match whole words, you ought to use regular expressions:

https://stackoverflow.com/questions/5319922/python-check-if-word-is-in-a-string

Was this helpful?
0 Comments
Join Devsheet Ask a Question