I have a database of words and a dataset with text lines. Every time there is a word in the line of the text file that appears in the words file as well, I want to do a trick. My code looks like:
import re
f = open(r"words.txt")
print len(flist)
d = open(r"text.txt", "r")
dlist = d.readlines()
for line in flist:
lowline = line.lower()
for word in dlist:
lowword = word.lower()
if lowword in lowline:
*trick*
However, this code finds no matches, altough there are many words that are exactly the same. Any thoughts on this one?