In reply to Climber_Bill:
> I have done it in bash using grep, which obviously does allow for the search to stop after the first match, but want to improve my knowledge of python and regex, that's all.
> Also, the files are on a Windows server.
> Homework? That's a good one. Unfortunately, I'm long past the days of homework.
> Cheers,
> TJB.
Ah okay - well that wasn't clear in the OP. And Windows has grep tools too - so you can do that.
If you want to improve your programming ability, start writing modular code, and write your own unit tests, component tests, system-level tests to test that everything works. There is almost no better way to improve.
Regarding your specific question - there is a 'break' statement you can use to exit the loop early, and then you'll only have a single item in the list. There are probably clearer ways than using for, if and break statements however (I haven't used python for years, and never properly - so can't help with specifics, but in general - imperative style programming is to be avoided in favor of declarative style.)
Age is no barrier to homework.