Skip to content

Commit 1de1d3d

Browse files
miss-islingtonadorilsonvstinnerStanFromIreland
authored
[3.13] gh-106318: Add examples for str.casefold() and str.lower() methods (GH-142154) (#143525)
gh-106318: Add examples for str.casefold() and str.lower() methods (GH-142154) (cherry picked from commit 51a56a3) 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>
1 parent 43e495d commit 1de1d3d

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

Doc/library/stdtypes.rst

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1706,6 +1706,14 @@ expression support in the :mod:`re` module).
17061706
lowercase letter ``'ß'`` is equivalent to ``"ss"``. Since it is already
17071707
lowercase, :meth:`lower` would do nothing to ``'ß'``; :meth:`casefold`
17081708
converts it to ``"ss"``.
1709+
For example:
1710+
1711+
.. doctest::
1712+
1713+
>>> 'straße'.lower()
1714+
'straße'
1715+
>>> 'straße'.casefold()
1716+
'strasse'
17091717

17101718
The casefolding algorithm is
17111719
`described in section 3.13 'Default Case Folding' of the Unicode Standard
@@ -2162,7 +2170,12 @@ expression support in the :mod:`re` module).
21622170
.. method:: str.lower()
21632171

21642172
Return a copy of the string with all the cased characters [4]_ converted to
2165-
lowercase.
2173+
lowercase. For example:
2174+
2175+
.. doctest::
2176+
2177+
>>> 'Lower Method Example'.lower()
2178+
'lower method example'
21662179

21672180
The lowercasing algorithm used is
21682181
`described in section 3.13 'Default Case Folding' of the Unicode Standard

0 commit comments

Comments
 (0)