https://github.com/python/cpython/commit/5b203f511be80b9db7697606783ef2d3f3a4d92e commit: 5b203f511be80b9db7697606783ef2d3f3a4d92e branch: 3.13 author: Miss Islington (bot) <31488909+miss-isling...@users.noreply.github.com> committer: hugovk <1324225+hug...@users.noreply.github.com> date: 2025-05-23T09:50:17Z summary:
[3.13] gh-106318: Add example for `str.center()` (GH-134518) (#134572) Co-authored-by: Blaise Pabon <bla...@gmail.com> files: M Doc/library/stdtypes.rst diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index ccaa0efaada7c7..a856047f2d6e82 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -1652,8 +1652,14 @@ expression support in the :mod:`re` module). Return centered in a string of length *width*. Padding is done using the specified *fillchar* (default is an ASCII space). The original string is - returned if *width* is less than or equal to ``len(s)``. - + returned if *width* is less than or equal to ``len(s)``. For example:: + + >>> 'Python'.center(10) + ' Python ' + >>> 'Python'.center(10, '-') + '--Python--' + >>> 'Python'.center(4) + 'Python' .. method:: str.count(sub[, start[, end]]) _______________________________________________ Python-checkins mailing list -- python-checkins@python.org To unsubscribe send an email to python-checkins-le...@python.org https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: arch...@mail-archive.com