How do I cut parts from a text file

Rigga rigga at hasnomail.com
Tue Dec 21 17:25:57 EST 2004


Hi,

I am new to Python and need to parse a text file and cut parts out i.e. say
the text file contained 5 rows of text:

line 1 of the text file
line 2 of the text file
line 3 of the text file
line 4 of the text file
line 5 of the text file

And the text I want starts at line 2 and goes through to line 4, what is the
best way to cut this text out? I guess I need to mark the start and end of
the text and then pass these values to a command which will chop the file
at that location however I am at a loss.

Any advice or pointers of where to find more info would be greatly
appreciated.

Thanks

RiGGa



More information about the Python-list mailing list