Hasty Briefsbeta

TIL: Python's splitlines does more than just newlines

7 hours ago
  • #Python
  • #Unicode
  • #String Manipulation
  • Python's `str.splitlines()` splits strings on more than just universal newlines (`\n`, `\r`, `\r\n`).
  • It also splits on various Unicode control codes and separators like Line Tabulation (`\v`), Form Feed (`\f`), and others.
  • This behavior can be surprising, as it includes non-printable characters with assigned semantics in certain ecosystems.
  • The function's behavior serves as a reminder that Unicode encompasses more than just printable characters.