[Tutor] Incrementing a line?
Jim Boone
jboone01 at bcuc.ac.uk
Tue Dec 9 06:54:12 EST 2003
Howdy all, i hope this is the right list for my query, pythons a bit new
to me, and I'm trying dto something that I can't figure out:
for s in userlog.readlines():
for word in s.split():
if word == ("19(Constraint"):
constraintlog.write(s + "\n")
print "\n\n*****Constraint Violations exist!!*****\n\n"
constraintlog.close()
Is a section of code i have, it reads a log file and cranks out a log
file on a certain condition, I can get it to write out the same line
which is in the original log file, which is useful, but, what would be
much more useful is if i could write out the line thats 10 lines after
the "19(Constraint", because it's more pertinent, but of course s+10 is
stupidly wrong.
Any help appreciated, Thanks!
--
Jim Boone
--------------------------------------------
Buckinghamshire Chilterns University College
R&D Manager - Information and Communication Technologies
Tel: 01494 522141 ext 3569
The myth that Bill Gates has appeared like a knight in shining armor to lead all customers out of a mire of technological chaos neatly ignores the fact that it was he who, by peddling second-rate technology, led them into it in the first place, and continues to do so today.
~Douglas Adams~
More information about the Tutor
mailing list