Skip to content

Commit f3f0b0a

Browse files
miss-islingtonblaisepadorilsonhugovk
authored
[3.14] gh-106318: Add an example for str.capitalize() (GH-134272) (GH-161324)
(cherry picked from commit c3e2422) Co-authored-by: Blaise Pabon <254456+blaisep@users.noreply.github.com> Co-authored-by: Adorilson Bezerra <adorilson@gmail.com> Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
1 parent 17a9a97 commit f3f0b0a

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

‎Doc/builtins/stdtypes.rst‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1858,13 +1858,23 @@ expression support in the :mod:`re` module).
18581858
.. method:: str.capitalize()
18591859

18601860
Return a copy of the string with its first character capitalized and the
1861-
rest lowercased.
1861+
rest lowercased. For example:
1862+
1863+
.. doctest::
1864+
1865+
>>> 'PYTHON IS AMAZING'.capitalize()
1866+
'Python is amazing'
1867+
>>> 'Njemačka starts With a non-ASCII digraph'.capitalize()
1868+
'Njemačka starts with a non-ascii digraph'
1869+
1870+
See also :meth:`title`.
18621871

18631872
.. versionchanged:: 3.8
18641873
The first character is now put into titlecase rather than uppercase.
18651874
This means that characters like digraphs will only have their first
18661875
letter capitalized, instead of the full character.
18671876

1877+
18681878
.. method:: str.casefold()
18691879

18701880
Return a casefolded copy of the string. Casefolded strings may be used for

0 commit comments

Comments
 (0)