Parsing text

Peter Hansen peter at engcorp.com
Mon Dec 19 19:38:43 EST 2005


sicvic 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.

That's a good start.  Maybe you could post the code that you've already 
got that does this, and people could comment on it and help you along. 
(I'm suggesting that partly because this almost sounds like homework, 
but you'll benefit more by doing it this way than just by having an 
answer handed to you whether this is homework or not.)

-Peter




More information about the Python-list mailing list