I have a doc file that it has the following structure:
This is a fairy tale written by
John Doe and Mary Smith
Auckland,somewhere
This story is awesome
I would like to extract the two lines of text which are:
John Doe and Mary Smith
Auckland,somewhere
and append those values into a list by using regex. The two lines that I want to extract are always between the lines This is a fairy tale written by and This story is awesome. How can I do that? I have tried some combinations with before_keyword,keyword,after_keyword=text.partition(regex), but no luck at all.
re(regex) standard library. Specificallyre.search(): docs.python.org/3/library/re.html#re.search Give that a read and if you still have questions, please advise.