Reading multiple lines into list : solution 2


/ Published in: Python
Save to your folder(s)



Copy this code and paste it in your HTML
  1. import re
  2.  
  3. text = open("foo.txt").read()
  4. RE = re.compile('firstword.*?wordx word word word (.*?) word.*?wordz word word word (.*?) word', re.DOTALL)
  5. print RE.findall(text)

URL: http://stackoverflow.com/questions/1062171/python-reading-multiple-lines-into-list

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.