python
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!')
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?
Similar Posts
- Python - Get first word form a string
- Check if String contains a Substring in Python
- Check python version on Mac and Windows
- Check if a key exist in a dictionary Python
- Check if given value is a number or integer in python
- Python check NaN values with and without using packages
- Check if two lists are similar in Python