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