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\'):
Use regex with word boundaries:
regex
>>> import re >>> r = re.compile(r'\bor\b') >>> r.search('and or not') <_sre.SRE_Match object at 0x7f2f7f8b2ed0> >>> r.search('and xor not')