We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
str.center()
1 parent 73967c4 commit 7efe67aCopy full SHA for 7efe67a
Doc/library/stdtypes.rst
@@ -1788,8 +1788,14 @@ expression support in the :mod:`re` module).
1788
1789
Return centered in a string of length *width*. Padding is done using the
1790
specified *fillchar* (default is an ASCII space). The original string is
1791
- returned if *width* is less than or equal to ``len(s)``.
1792
-
+ returned if *width* is less than or equal to ``len(s)``. For example::
+
1793
+ >>> 'Python'.center(10)
1794
+ ' Python '
1795
+ >>> 'Python'.center(10, '-')
1796
+ '--Python--'
1797
+ >>> 'Python'.center(4)
1798
+ 'Python'
1799
1800
1801
.. method:: str.count(sub[, start[, end]])
0 commit comments