Skip to content

Commit 17bf91d

Browse files
committed
gh-106318: Add examples for str.casefold() and str.lower() methods
1 parent 52f9b5f commit 17bf91d

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

Doc/library/stdtypes.rst

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1841,7 +1841,14 @@ expression support in the :mod:`re` module).
18411841
intended to remove all case distinctions in a string. For example, the German
18421842
lowercase letter ``'ß'`` is equivalent to ``"ss"``. Since it is already
18431843
lowercase, :meth:`lower` would do nothing to ``'ß'``; :meth:`casefold`
1844-
converts it to ``"ss"``.
1844+
converts it to ``"ss"``, as follows:
1845+
1846+
.. doctest::
1847+
1848+
>>> 'ß'.casefold()
1849+
'ss'
1850+
>>> 'ß'.lower()
1851+
'ß'
18451852

18461853
The casefolding algorithm is `described in section 3.13.3 'Default Case
18471854
Folding' of the Unicode Standard
@@ -2250,7 +2257,12 @@ expression support in the :mod:`re` module).
22502257
.. method:: str.lower()
22512258

22522259
Return a copy of the string with all the cased characters [4]_ converted to
2253-
lowercase.
2260+
lowercase. For example:
2261+
2262+
.. doctest::
2263+
2264+
>>> 'Lower Method Example'.lower()
2265+
'lower method example'
22542266

22552267
The lowercasing algorithm used is `described in section 3.13.2 'Default Case
22562268
Conversion' of the Unicode Standard

0 commit comments

Comments
 (0)