Home:ALL Converter>how can i search for a specific word in python?

how can i search for a specific word in python?

Ask Time:2013-12-06T23:11:39         Author:user3074910

Json Formatter

Is there a way to search a specific word in python, like 'or'. I did this:

word = raw_input("what do you want to search? ")
for filee in open('text.txt'):
   if word in filee:
     print "found"

But it looks for the string 'or'. For example; if the word 'world' exists in text.txt or some other word containing the 'or' string it prints "found"

Is there a way to search only for that specific word 'or' ?

Author:user3074910,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/20427267/how-can-i-search-for-a-specific-word-in-python
yy