[Python-Dev] PEP 385: the eol-type issue
Neil Hodgson
nyamatongwe at gmail.com
Thu Aug 6 00:22:14 CEST 2009
Glenn Linderman:
> and perhaps other things (and
> are there new Unicode control characters that could be used for line
> endings?),
Unicode includes Line Separator U+2028 and Paragraph Separator
U+2029 but they are rarely supported and very rarely used. They are a
pain to work with since they are 3 byte sequences in UTF-8. Visual
Studio does support them.
Python does not currently support these line separators such as in
this example which only reads 2 lines rather than 3:
with open("x.txt", "wb") as f:
f.write("a\nb\u2029c\n".encode('utf-8'))
with open("x.txt", "r") as f:
n = 1
for l in f.readlines():
print(n, repr(l))
n += 1
Neil
More information about the Python-Dev
mailing list