Bryan Fodness wrote:
> I also have some information at the beginning of the file and between
> each field. Is there a way to get the info at the beginning and tell
> it once it sees Leaf 1A to read the values for the next 120 and then
> repeat until there are no more Fields.
This should be a pretty simple modification to the technique I showed
you using f.next(). Just add another loop to process the header fields.
If you have variable-length sections then you may have to 'prefetch' the
next line, something like this:
try:
line = f.next()
while True:
if 'Leaf 1A' in line:
break
# process header line
# 'line' already contains the next line
while True:
# process body line
line = f.next()
Kent
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor