Reading lines of null-terminated text?

Ian Kelly ian.g.kelly at
Tue Nov 30 01:00:02 CET 2010

On Mon, Nov 29, 2010 at 4:17 PM, MRAB <python at> 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.


More information about the Python-list mailing list