Re: [Tutor] Parsing text file

2007-05-14 Thread Dave Kuhlman
On Sun, May 13, 2007 at 03:04:36PM -0700, Alan wrote: > I'm looking for a more elegant way to parse sections of text files that > are bordered by BEGIN/END delimiting phrases, like this: > > some text > some more text > BEGIN_INTERESTING_BIT > someline1 > someline2 > someline3 > END_INTERESTING_B

Re: [Tutor] Parsing text file

2007-05-13 Thread Alan Gauld
"Alan" <[EMAIL PROTECTED]> wrote > I'm looking for a more elegant way to parse sections of text files > that > are bordered by BEGIN/END delimiting phrases, like this: > > some text > BEGIN_INTERESTING_BIT > someline1 > someline3 > END_INTERESTING_BIT > more text > > What I have been doing is cl

Re: [Tutor] Parsing text file

2007-05-13 Thread John Fouhy
On 14/05/07, Alan <[EMAIL PROTECTED]> wrote: > I'm looking for a more elegant way to parse sections of text files that > are bordered by BEGIN/END delimiting phrases, like this: > > some text > some more text > BEGIN_INTERESTING_BIT > someline1 > someline2 > someline3 > END_INTERESTING_BIT > more t

Re: [Tutor] parsing text

2007-03-24 Thread Kent Johnson
Alan Gauld wrote: >> 1.) when i do readlines and create a list and then print the list it >> adds a blank line between every line of text > > I suspect that's because you are reading a newline character > from the file and print adds a newline of its own. You need to > use rstrip() to take out th

Re: [Tutor] parsing text

2007-03-24 Thread Alan Gauld
"Jay Mutter III" <[EMAIL PROTECTED]> wrote > i have the following text: > > Barnett, John B., assignor of one-half to R. N. Tutt, Kansas City, > Mo.Automatic display-sign.No. 1,330 411-Apr. 13 ; v. 273 ; > p. > 193. > Barnett, John II.. Tettenhall, England. Seat of > motorcars.

Re: [Tutor] Parsing text file with Python

2007-03-23 Thread Alan Gauld
"Jay Mutter III" <[EMAIL PROTECTED]> wrote > 1.) Are there better ways to write this? There are always other ways, as to which is better depends on your judgement criteria. Your way works. > 2.) As it writes out the one group to the new file for companies it > is as if it leaves blank lines behi