Hans Müller a écrit :
Hello,I'm quite often using this construct: for l in open("file", "r"): do something here, l contains the \n or \r\n on windows at the end. I get rid of it this way: for l in open("file", "r"): while l[-1] in "\r\n": l = l[:-1] I find this a little bit clumsy,
indeed.
but it works fine. Has someone a better solution ?
help(str.rstrip) -- http://mail.python.org/mailman/listinfo/python-list