[issue39036] Add center_char attribute to str type

Lovi report at bugs.python.org
Fri Dec 13 20:25:56 EST 2019


Lovi <1668151593 at qq.com> added the comment:

Sorry, I made a mistake.

The center char of '12345' is '3' and the center char of 'abcd' is '' because it doesn't have the most central character.

In my opinion, with center_char, when you need the center character of a string you can get it directly with str.center_char instead of tedious index and calculation.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39036>
_______________________________________


More information about the Python-bugs-list mailing list