On Fri, May 2, 2008 at 3:55 AM, Roel Schroeven
<[EMAIL PROTECTED]> wrote:

>  Shouldn't it even be 'line = f.next()'?

Wow, I think Brain Stormer should get a prize. I'm not sure what the
prize is, but his short program has elicited incomplete and inaccurate
answers from three of the top posters to this list! I *think* this is
a complete answer:

f = open('file.txt',r)
for line in f:
     if line.rstrip() == "3":
           line = f.next()
           print line
           break # put this in if there is only one line you want to print
f.close()

...awaiting any further corrections :-)
Kent
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to