擅长:python、mysql、java
<pre><code>def init_contains_useful_word(words_to_search_for):
def contains_useful_word(sentence):
return any(map(lambda x: x in sentence, words_to_search_for))
with open(filename, 'r') as f:
text = f.read()
sentences = text.split(".")
for words in list_of_lists:
contains_useful_word = init_contains_useful_word(words)
sentences = filter(contains_useful_word, sentences)
with open(filename, 'w') as f:
f.write(sentences.join(" "))
</code></pre>
<p>实际上,如果你愿意,你可以用你的重运算符替换包含有用的单词。在</p>