Pete O'Connell wrote:
Write {
file /Volumes/raid0/Z353_002_comp_v27.%04d.cin
file_type cin
name Write1
xpos 13762
ypos -364
}
The simplest approach imho is to parse the input with a proper parser, eg PLY
or pyparsing.
If you want to do the parsing manually, I'd start by classifying each line
manually to be one of
<empty>
"Write" "{"
<identifier> <argument>
"}"
and then collect the lines of each group to eg a dict (if there are no
duplicate keys, and order is not relevent).
In both cases, you'll end up with a list of collected groups.
Once you have that, you can do your processing.
Finally, convert the groups back to text.
Albert
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor