F
Follower
An alternative approach (which I'm sure will offend just as manyEgbert Bouwman said:Of course it is not difficult to test if you are reading the first line
or another one, but it hurts my feelings to do a test which by definition
succeeds at the first record, and never afterwards.
Any suggestions ?
sensibilities) is to use a function that replaces itself.
------ Pseudo-code ------
def process_firstline(...):
# ...do something here...
global processline
processline = process_otherlines
def process_otherlines(...):
# ...do something here...
processline = process_firstline
for line in file:
result = processline(line)
----------------------------
If you read more than one file you'll need to reset processline at the
beginning of each file.
I never said this was a *good* way, just one way.
--Phil.