[Python-ideas] Format character to center strings

Rob Cliffe rob.cliffe at btinternet.com
Sat Mar 28 19:59:01 CET 2015


On 28/03/2015 18:11, Mark Lawrence wrote:
> On 28/03/2015 14:56, Rob Cliffe wrote:
>> As a string can be left-justified (within a given width) using e.g.
>>      '%-20s' % s
>> and right-justified using
>>      '%+20s' % s    #    or    '%20s' % s
>> why not allow a string to be centered using
>>      '%=20s' %s
>>
>> Rob Cliffe
>>
>
> This http://bugs.python.org/issue23624 was rejected so I see two 
> chances of this happening, zero or none.
>
Except that that referred to a proposed change that would break existing 
code.  This is a proposed new feature which wouldn't.  (And for what 
it's worth, I too would prefer it to add an odd pad character on the right.)


More information about the Python-ideas mailing list