Detecting line endings

Sybren Stuvel sybrenUSE at YOURthirdtower.com.imagination
Mon Feb 6 10:17:36 EST 2006


Fuzzyman enlightened us with:
> My worry is that if '\n' *doesn't* signify a line break on the Mac,
> then it may exist in the body of the text - and trigger ``ending =
> '\n'`` prematurely ?

I'd count the number of occurences of '\r\n', '\n' without a preceding
'\r' and '\r' without following '\n', and let the majority decide.

Sybren
-- 
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself? 
                                             Frank Zappa



More information about the Python-list mailing list