One last, small correction: you probably wanted the s* before "END TREES" to be \s*. But I expect you likely want a trailing newline on the code you find, so you might want to just leave it out.

— Andy

On Oct 2, 2014, at 3:31 PM, Lachance, Michael - APHIS <[log in to unmask]> wrote:

Thanks to everyone for their help!

 

Here is the final code that gave me the best result:

-----

import os, re

 

file = open("200214092341eriswor_1_56.txt", "r")

s = file.read()

r = re.compile('"TREES"\s*(.*?)s*"END TREES"', re.DOTALL)

trees = r.findall(s)

for tree in trees:

    print tree

-----

 

 

 

Kind regards,

 

Michael Lachance

Plant Protection Technician

ALB Eradication Program USDA APHIS

151 West Boylston Drive

Worcester, MA 01606

508.852.8090 (o)

508.414.5673 (c)

The USDA is an equal opportunity provider and employer.

Federal Relay Service (Voice/TTY/ASCII/Spanish) 1-800-877-8339

 

This electronic message contains information generated by the USDA solely for the intended recipients. Any unauthorized interception of this message or the use or disclosure of the information it contains may violate the law and subject the violator to civil or criminal penalties. If you believe you have received this message in error, please notify the sender and delete the email immediately.

.


------------------------------------------------------------------------- This list (NEARC-L) is an unmoderated discussion list for all NEARC Users.

If you no longer wish to receive e-mail from this list, you can remove yourself by going to http://listserv.uconn.edu/nearc-l.html.