]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-106318: Add examples for str.casefold() and str.lower() methods (GH-142154...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 7 Jan 2026 17:03:24 +0000 (18:03 +0100)
committerGitHub <noreply@github.com>
Wed, 7 Jan 2026 17:03:24 +0000 (18:03 +0100)
gh-106318: Add examples for str.casefold() and str.lower() methods (GH-142154)
(cherry picked from commit 51a56a3a7bd8cf05ceda65e843fb7bae40509799)

Co-authored-by: Adorilson Bezerra <adorilson@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Doc/library/stdtypes.rst

index c8cbf642ea6364c9e7922c8bc364c29f0dd267af..3efe8ede5cc83f8712a5ed5f9754793f3a9dcc1d 100644 (file)
@@ -1706,6 +1706,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
@@ -2162,7 +2170,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