My apologies if someone else has already pointed out this difference between sys.stdin.readline() and raw_input(): they return different strings.
>>> a = sys.stdin.readline() spam >>> b = raw_input() spam >>> a 'spam\n' >>> b 'spam' IMHO, that trailing NL character ... (1) ... indicates the fact that these two functions were really designed for different purposes: getting data from a file vs. getting data interactively from a person. (2) ... would impose yet another trap for beginning users to fall into. ("Teacher, I typed in 'Richard', but Python doesn't seem to think I did.") Sure, we can try to sell strip() to the student, but I wouldn't blame him/her for suspecting that Python is so dumb that it doesn't distinguish between the content of a message and the gesture than ends the message. -John Posner _______________________________________________ Edu-sig mailing list Edu-sig@python.org http://mail.python.org/mailman/listinfo/edu-sig