Re: [Tutor] Removing/Handing large blocks of text

2004-12-09 Thread Jesse Noller
On Wed, 8 Dec 2004 15:11:55 +, Max Noel <[EMAIL PROTECTED]> wrote: > > > > On Dec 8, 2004, at 14:42, Jesse Noller wrote: > > > Hello, > > > > I'm trying to do some text processing with python on a farily large > > text file (actually, XML, but I am handling it as plaintext as all I > > need

Re: [Tutor] Removing/Handing large blocks of text

2004-12-08 Thread Alan Gauld
> I'm trying to do this with the re module - the two tags looks like: > > > ... > a bunch of text (~1500 lines) > ... > > > I need to identify the first tag, and the second, and unconditionally > strip out everything in between those two tags, making it look like: > > > A very simp

Re: [Tutor] Removing/Handing large blocks of text

2004-12-08 Thread Kent Johnson
I would use a loop with a flag to indicate whether you are in the block or not. If the tags are always and on a line by themselves you don't need an re: lines = [] appending = True f = open('foobar.txt', 'r') for line in f: if appending: lines.append(line) if line.strip() == '':

Re: [Tutor] Removing/Handing large blocks of text

2004-12-08 Thread Max Noel
On Dec 8, 2004, at 14:42, Jesse Noller wrote: Hello, I'm trying to do some text processing with python on a farily large text file (actually, XML, but I am handling it as plaintext as all I need to do is find/replace/move) and I am having problems with trying to identify two lines in the text file,

[Tutor] Removing/Handing large blocks of text

2004-12-08 Thread Jesse Noller
Hello, I'm trying to do some text processing with python on a farily large text file (actually, XML, but I am handling it as plaintext as all I need to do is find/replace/move) and I am having problems with trying to identify two lines in the text file, and remove everything in between those two l