#splitlines

[ follow ]
Artificial intelligence
fromPycoders
1 week ago

PyCoder's Weekly | Issue #703

Python 3.14 improves syntax error messages; PEP 8 remains controversial; prefer splitlines() for line splitting; new PEPs and Django security updates were released.
fromPythonmorsels
2 weeks ago

Why splitlines() instead of split("\n")?

Let's say we have some text that was retrieved from a database, and the original text came from a form submission in a web browser. Web browsers often represent line breaks as a carriage return character, followed by a line feed character: That's what we see in our text as well: \r followed by \n. This is often called CRLF (carriage return and line feed) whereas \n is called LF (line feed).
Python
[ Load more ]