Python 2.5.2: remove what found between two lines that contain two concrete strings

Posted by user248959 on Stack Overflow See other posts from Stack Overflow or by user248959
Published on 2010-04-05T16:49:19Z Indexed on 2010/04/05 16:53 UTC
Read the original article Hit count: 236

Filed under:
|
|
|

Hi,

is there any way to remove what found between two lines that contain two concrete strings?

I mean: I want to remove anything found between 'heaven' and 'hell' in a text file with this text:

I'm in heaven
foobar
I'm in hell

After executing the script/function i'm asking the text file will be empty.

Regards

Javi

© Stack Overflow or respective owner

Related posts about python

Related posts about newbie