Message363247
| Author |
vstinner |
| Recipients |
Anthony Sottile, abartlet, miss-islington, pitrou, serhiy.storchaka, vstinner |
| Date |
2020年03月03日.09:15:47 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1583226947.93.0.382040094246.issue37330@roundup.psfhosted.org> |
| In-reply-to |
| Content |
> Thankfully we don't need universal newlines, but no matter if we need them, old versions of Samba will fail to build without a fix-up patch.
io.open() is available since Python 2.6 and handles different kinds of newlines transparently. Example:
$ python2
Python 2.7.17 (default, Oct 20 2019, 00:00:00)
>>> f=open("test", "wb"); f.write("a\rb\rc\r"); f.close()
>>> import io; f=io.open("test"); lines=list(f); f.close(); lines
[u'a\n', u'b\n', u'c\n']
Do you suggest to change the documentation to suggest to open io.open() for applications which still care about Python 2?
https://docs.python.org/dev/whatsnew/3.9.html#changes-in-the-python-api
Note: Python 2 is no longer supported upstream, I strongly advice you to upgrade to Python 3. |
|