Reading lines of null-terminated text?

Ian Kelly ian.g.kelly at gmail.com
Mon Nov 29 19:00:02 EST 2010


On Mon, Nov 29, 2010 at 4:17 PM, MRAB <python at mrabarnett.plus.com> wrote:
> In Python 3 it's possible to specify the newline character, but I've
> found that it won't accept the null character as newline. I don't know
> why. :-(

Because it isn't a legal value.

"newline controls how universal newlines works (it only applies to
text mode). It can be None, '', '\n', '\r', and '\r\n'."

Why it was designed that way, I don't know.  Maybe to avoid scenarios
where the selected newline has more than one representation in the
selected encoding.

Cheers,
Ian



More information about the Python-list mailing list