Skip to content

Commit 2194efe

Browse files
committed
Add an example for str.capitalize for #106318
This is the smallest possible step toward adding examples for the string methods. The content was contributed by @adorilson in #105670 Because #119445 is big and difficult to review, this PR will be updated as the individual examples get merged.
1 parent e79f640 commit 2194efe

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Doc/library/stdtypes.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1759,7 +1759,14 @@ expression support in the :mod:`re` module).
17591759
.. method:: str.capitalize()
17601760

17611761
Return a copy of the string with its first character capitalized and the
1762-
rest lowercased.
1762+
rest lowercased. For example::
1763+
1764+
>>> 'PYTHON IS AMAZING'.capitalize()
1765+
'Python is amazing'
1766+
>>> 'Njemačka Starts With a non-english Digraph'.capitalize()
1767+
'Njemačka starts with a non-english digraph'
1768+
1769+
See also :meth:`title`.
17631770

17641771
.. versionchanged:: 3.8
17651772
The first character is now put into titlecase rather than uppercase.

0 commit comments

Comments
 (0)