Todd Walton wrote:
So, the script runs through the text file line by line, until it
finds the opening description tag and then, starting with the next
line, writes it all out to a new file until it comes to the
end-description tag. Same for the other two. Will this work? If
the blocks are out of order in the datafile will this still work?
Possibly, but you're making an awful lot of work for yourself and it
will be brittle if you need add or subtract sections with time.
Should I change something?
Yes, this is the kind of thing that XML was actually made for.
Since you are already using "HTML-style" tags, I heartily recommend that
you add just enough extra structure so that you can let any of the
myriad XML DOM bindings just suck the whole file in and then work on it.
The magic keywords in Python are probably pulldom and/or elementtree.
I'm sure Perl has something similar.
-a
--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list