My script finds other words along with the word like apple, such as app, me, ple, appl, etc. which in the search_word, but i don't want it, i need the script to define only the complete word which in the contents but not its parts.
apple - yes, i want to define this word.
app - no, i don't want to define this word.
list.txt contains:
apple
code:
with open('list.txt') as file:
contents = file.read()
search_word = input("enter a word you want to search in file: ")
if search_word in contents:
print ('word found')
else:
print ('word not found')
this not work:
if search_word == contents: