[3.14] gh-106318: Add example for str.center() (GH-134518) (#134571)

Co-authored-by: Blaise Pabon <blaise@gmail.com>
This commit is contained in:
Miss Islington (bot) 2025-05-23 11:51:17 +02:00 committed by GitHub
parent 73967c4c01
commit 7efe67ae35
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1788,8 +1788,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]])