https://github.com/python/cpython/commit/c3e24227320515456dc8a9e1cb88503fab5d0191
commit: c3e24227320515456dc8a9e1cb88503fab5d0191
branch: main
author: Blaise Pabon <[email protected]>
committer: encukou <[email protected]>
date: 2026-11-04T16:30:15Z
summary:

gh-106318: Add an example for `str.capitalize()` (GH-134272)


Co-authored-by: Adorilson Bezerra <[email protected]>
Co-authored-by: Hugo van Kemenade <[email protected]>

files:
M Doc/builtins/stdtypes.rst

diff --git a/Doc/builtins/stdtypes.rst b/Doc/builtins/stdtypes.rst
index 0cf234217cc5af7..1b4f25534e26b65 100644
--- a/Doc/builtins/stdtypes.rst
+++ b/Doc/builtins/stdtypes.rst
@@ -2129,13 +2129,23 @@ expression support in the :mod:`re` module).
 .. method:: str.capitalize()
 
    Return a copy of the string with its first character capitalized and the
-   rest lowercased.
+   rest lowercased. For example:
+
+   .. doctest::
+
+      >>> 'PYTHON IS AMAZING'.capitalize()
+      'Python is amazing'
+      >>> 'Njemačka starts With a non-ASCII digraph'.capitalize()
+      'Njemačka starts with a non-ascii digraph'
+
+   See also :meth:`title`.
 
    .. versionchanged:: 3.8
       The first character is now put into titlecase rather than uppercase.
       This means that characters like digraphs will only have their first
       letter capitalized, instead of the full character.
 
+
 .. method:: str.casefold()
 
    Return a casefolded copy of the string. Casefolded strings may be used for

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to