Detecting line endings

Fuzzyman fuzzyman at gmail.com
Wed Feb 8 07:10:32 EST 2006


Fuzzyman wrote:
> Alex Martelli wrote:
> > Fuzzyman <fuzzyman at gmail.com> wrote:
> >    ...
> > > > Open the file with 'rU' mode, and check the file object's newline
> > > > attribute.
> > >
>
> Just to confirm, for a UTF16 encoded file, the newlines attribute is
> ``None``.
>

Hmmm... having read the documentation, the newlines attribute remains
None until some newlines are encountered. :oops:

I don't think it's technique is any better than mine though. ;-)

Fuzzy
http://www.voidspace.org.uk/python/index.shtml


> All the best,
> 
> Fuzzyman
> http://www.voidspace.org.uk/python/index.shtml




More information about the Python-list mailing list