poemecanic2~20171217-155022.py 300 B

123456789101112
  1. def findTheWordsBefore(paragraph):
  2. import re
  3. prose = re.compile(r"(\s\w*\s\w*\s\w*)\s+drill")
  4. List = prose.split(paragraph)
  5. return List
  6. with open("how_2_use_drill.txt", "r" ) as source:
  7. for line in source:
  8. sentences = findTheWordsBefore(line)
  9. for s in sentences:
  10. print s.strip()