I have a dictionary words list and a sentences list, now I need to check each word(all are different) if in each sentence(all are different) so I my code like that,
word_list = ["人", "天", "地"] #over 100 ords in actual dict
input_file = ["你是不是经常也告诉自己", "不管发生什么事情", "都要微笑着面对生活"] #over 1000 sentences
output = []
for line in input_file:
for word in word_list:
if word in line:
output.append(word)
However, I was wondering if it will cost much more time if I use two-loops, is there some better method can finish this job, what about using dict?