/ Published in: Python
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
import re text = open("foo.txt").read() RE = re.compile('firstword.*?wordx word word word (.*?) word.*?wordz word word word (.*?) word', re.DOTALL) print RE.findall(text)
URL: http://stackoverflow.com/questions/1062171/python-reading-multiple-lines-into-list