Re: Simple text parsing gets difficult when line continues to next line

2006-11-28 Thread Jacob Rael
Thanks all. I think I'll follow the "don't do that" advice. jr Jacob Rael wrote: > Hello, > > I have a simple script to parse a text file (a visual basic program) > and convert key parts to tcl. Since I am only working on specific > sections and I need it quick, I decided not to learn/try a full

Re: Simple text parsing gets difficult when line continues to next line

2006-11-28 Thread John Machin
Tim Hochberg wrote: [snip] > I agree that mixing the line assembly and parsing is probably a mistake > although using next explicitly is fine as long as your careful with it. > For instance, I would be wary to use the mixed for-loop, next strategy > that some of the previous posts suggested. Here'

Re: Simple text parsing gets difficult when line continues to next line

2006-11-28 Thread Tim Hochberg
John Machin wrote: > Jacob Rael wrote: >> Hello, >> >> I have a simple script to parse a text file (a visual basic program) >> and convert key parts to tcl. Since I am only working on specific >> sections and I need it quick, I decided not to learn/try a full blown >> parsing module. My simple scri

Re: Simple text parsing gets difficult when line continues to next line

2006-11-28 Thread John Machin
Jacob Rael wrote: > Hello, > > I have a simple script to parse a text file (a visual basic program) > and convert key parts to tcl. Since I am only working on specific > sections and I need it quick, I decided not to learn/try a full blown > parsing module. My simple script works well until it runs

Re: Simple text parsing gets difficult when line continues to next line

2006-11-28 Thread Roberto Bonvallet
Jacob Rael wrote: [...] > I would line to identify if a line continues (if line.endswith('_')) > and concate with the next line: > > line = line + nextLine > > How can I get the next line when I am in a for loop using readlines? Don't use readlines. # NOT TESTED program = open(fileName)

Re: Simple text parsing gets difficult when line continues to next line

2006-11-28 Thread Larry Bates
Jacob Rael wrote: > Hello, > > I have a simple script to parse a text file (a visual basic program) > and convert key parts to tcl. Since I am only working on specific > sections and I need it quick, I decided not to learn/try a full blown > parsing module. My simple script works well until it run

Simple text parsing gets difficult when line continues to next line

2006-11-28 Thread Jacob Rael
Hello, I have a simple script to parse a text file (a visual basic program) and convert key parts to tcl. Since I am only working on specific sections and I need it quick, I decided not to learn/try a full blown parsing module. My simple script works well until it runs into functions that straddle