Get the latest tech news

Python's splitlines does more than just newlines


(With thanks to Seth Larson for taking me down this rabbit hole.) I always assumed that Python's str.splitlines() split strings by "universal newlines", i.e., \n, \r, and \r\n. But it turns out it does a lot more than that.

None

Get the Android app

Or read this on Hacker News

Read more on:

Photo of python

python

Photo of TIL

TIL

Photo of newlines

newlines

Related news:

News photo

Python releases version 3.14 – with cautious free-threaded support

News photo

Python 3.14 Released With Performance Improvements, Free-Threading & Zstd

News photo

TIL: The Data Furnace