Hi,
I tried to follow the suggestions, so far, Im at here
Due to my errors, of not looping file correctly for the words.
I tried to follow the suggestions, so far, Im at here
import os Words=['Pear','Cherry'] with open('Phrases.txt','r') as inFile: text = inFile.read() sentences = text.split(".") for s in Words: with open("%s.txt" % s, "w") as f: for sentence in sentences: if (any(word in sentence for word in Words)): f.write(sentence + '\n')I do get 2 files - but not the right ouptut
Due to my errors, of not looping file correctly for the words.