"bob gailer" <[EMAIL PROTECTED]> wrote

  if line == "3":

Assuming you adopt my approach, then each line will be a digit followed by \n (newline). So no line will == "3". Instead use:

   if line[:-1] == "3":

or

    if line.rstrip() == "3"

or even

   if line.startswith("3"):

personally I prefer rstrip() over the -1 slice because it catches
more potential junk.

HTH,

--
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