xxxxxxxxxx
search_text = 'man'
str = 'You are good man.'
if search_text in str:
print(f'Found "{search_text}" in string')
else:
print('Not found')
xxxxxxxxxx
Input:
myStr = "py py py py"
print(myStr.find("js"))
print(myStr.index("js"))
Output:
-1
Traceback (most recent call last):
File "D:\Programming\python\article\find.py", line 38, in <module>
print(myStr.index("js"))
ValueError: substring not found