I feel like the answer should be updated to be ‘% bitcoin %’ OR ‘%bitcoin %’ OR ‘% bitcoin’ since the current answer also matches ‘bitcoins’ and ‘BITCOINS’ (and other variations). Obviously, I was over-thinking this but the question does say to search for the word ‘bitcoin’ and not the phrase.
% stands for zero or more characters, does it not? If so it should match any phrase with ‘bitcoin’ in it, regardless whether surrounded by other characters, including white space, or not. Am I wrong about this?
Not sure if I get your question, but on the surface, yes we can check any position by subscripting it.
Say our variable containing the title is named, title and we are looking to see if ‘word’ is at the 5th or 6th position…
title_split = title.split()
if title[4] == 'word' or title[5] == 'word':
If we are fairly certain there are no repeated words, we could query the index of the target, 'word'
title.index('word')
Eg.
>>> title = "A quick brown fox jumps over the lazy dog".split()
>>> title.index('fox')
3
>>> title.index('cat')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: 'cat' is not in list
>>>
We could check if the word is in the list, and if it is, then we can query the index.
if 'cat' in title:
print (title.index('cat'))
else:
print ('cat' not found in 'title')