This is my code, it currently prints the whole line, that contains the string. I want to print the whole sentence, that contains the searchString.
searchString = 'doctorate'
files = os.listdir() # goes directory with *.txt files
for eachFile in files:
with open(eachFile, 'r', encoding='utf-8') as currentFile:
allLines = currentFile.readlines()
for line in allLines:
if searchString in line:
print (line)
Any help will be apreciated...