"Brain Stormer" <[EMAIL PROTECTED]> wrote
f = open('file.txt',r)
for line in f.read():

This reads the whole file inta a string then iterates over all the characters(not lines) in that string.

Better to iterate over the file:

for line in f:


    if line == "3":
          line.next

this then becomes f.next() # next is a method not an attribute so needs the () to call it


--
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld

_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to