[Tutor] Tutor Digest, Vol 38, Issue 1

Alan Gauld alan.gauld at btinternet.com
Sun Apr 1 17:42:56 CEST 2007


"Rikard Bosnjakovic" <rikard.bosnjakovic at gmail.com> wrote 

>>>> s1 = "some line\n"
>>>> s2 = "some line"
>>>> s1.endswith("line"), s2.endswith("line")
> (False, True)
> 
> Just skip the if and simply rstrip the string.

Or add \n to the endswith() test string if you really only 
want to strip the newline in those cases....

Alan G.



More information about the Tutor mailing list