https://github.com/python/cpython/commit/f3f0b0ab4aefa7937e019bd9c0dbe877287e14ee commit: f3f0b0ab4aefa7937e019bd9c0dbe877287e14ee branch: 3.14 author: Miss Islington (bot) <[email protected]> committer: encukou <[email protected]> date: 2026-11-04T17:55:11+01:00 summary:
[3.14] gh-106318: Add an example for `str.capitalize()` (GH-134272) (GH-161324) (cherry picked from commit c3e24227320515456dc8a9e1cb88503fab5d0191) Co-authored-by: Blaise Pabon <[email protected]> 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 91f149f8d1c382d..1eb284b80975931 100644 --- a/Doc/builtins/stdtypes.rst +++ b/Doc/builtins/stdtypes.rst @@ -1858,13 +1858,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]
