Detecting line endings

Fuzzyman fuzzyman at gmail.com
Tue Feb 7 04:29:48 EST 2006


Alex Martelli wrote:
> Fuzzyman <fuzzyman at gmail.com> wrote:
>
> > Hello all,
> >
> > I'm trying to detect line endings used in text files. I *might* be
> > decoding the files into unicode first (which may be encoded using
>
> Open the file with 'rU' mode, and check the file object's newline
> attribute.
>

Do you know if this works for multi-byte encodings ? Do files have
metadata associated with them showing the line-ending in use ?

I suppose I could test this...

All the best,


Fuzzy

> > My worry is that if '\n' *doesn't* signify a line break on the Mac,
>
> It does, since a few years, since MacOSX is version of Unix to all
> practical intents and purposes.
> 
> 
> Alex




More information about the Python-list mailing list