On 05.06.2014 22:18, Ian Kelly wrote: > Personally I tend toward rstrip('\r\n') so that I don't have to worry > about files with alternative line terminators.
Hm, I was under the impression that Python already took care of removing the \r at a line ending. Checking that right now: (DOS encoded file "y") >>> for line in open("y", "r"): print(line.encode("utf-8")) ... b'foo\n' b'bar\n' b'moo\n' b'koo\n' Yup, the \r was removed automatically. Are there cases when it isn't? Cheers, Johannes -- >> Wo hattest Du das Beben nochmal GENAU vorhergesagt? > Zumindest nicht öffentlich! Ah, der neueste und bis heute genialste Streich unsere großen Kosmologen: Die Geheim-Vorhersage. - Karl Kaos über Rüdiger Thomas in dsa <hidbv3$om2$1...@speranza.aioe.org> -- https://mail.python.org/mailman/listinfo/python-list