On 19 Dec 2005 15:15:10 -0800, "sicvic" <[EMAIL PROTECTED]> wrote:
>I was wondering if theres a way where python can read through the lines >of a text file searching for a key phrase then writing that line and >all lines following it up to a certain point, such as until it sees a >string of "---------------------" > >Right now I can only have python write just the line the key phrase is >found in. > This sounds like homework, so just a (big) hint: have a look at itertools dropwhile and takewhile. The solution is potentially a one-liner, depending on your matching criteria (e.g., case-sensitive fixed string vs regular expression). Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list