From 76afbe2747df684df5d9bc52a422cb3767fde04d Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Wed, 7 Jan 2026 18:03:20 +0100 Subject: [PATCH] [3.14] gh-106318: Add examples for str.casefold() and str.lower() methods (GH-142154) (#143524) gh-106318: Add examples for str.casefold() and str.lower() methods (GH-142154) (cherry picked from commit 51a56a3a7bd8cf05ceda65e843fb7bae40509799) Co-authored-by: Adorilson Bezerra Co-authored-by: Victor Stinner Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> --- Doc/library/stdtypes.rst | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index 492282dc7b7..f0bf9bd8b6b 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -1844,6 +1844,14 @@ expression support in the :mod:`re` module). lowercase letter ``'ß'`` is equivalent to ``"ss"``. Since it is already lowercase, :meth:`lower` would do nothing to ``'ß'``; :meth:`casefold` converts it to ``"ss"``. + For example: + + .. doctest:: + + >>> 'straße'.lower() + 'straße' + >>> 'straße'.casefold() + 'strasse' The casefolding algorithm is `described in section 3.13 'Default Case Folding' of the Unicode Standard @@ -2300,7 +2308,12 @@ expression support in the :mod:`re` module). .. method:: str.lower() Return a copy of the string with all the cased characters [4]_ converted to - lowercase. + lowercase. For example: + + .. doctest:: + + >>> 'Lower Method Example'.lower() + 'lower method example' The lowercasing algorithm used is `described in section 3.13 'Default Case Folding' of the Unicode Standard