Replace weird error message?
Chris Angelico
rosuav at gmail.com
Wed Mar 16 15:08:52 EDT 2016
On Thu, Mar 17, 2016 at 5:53 AM, Ben Finney <ben+python at benfinney.id.au> wrote:
>> For example a hint that "0" does work for the given argument.
>
> I suggest: “zero-padding only allowed for numeric types, not 'str'”.
That's very slightly misleading too; zero padding is perfectly legal
as long as you force the alignment:
>>> "{:>05}".format("1")
'00001'
>>> "{:>05}".format("2")
'00002'
>>> "{:>05}".format("-3")
'000-3'
Though as the last example shows, this doesn't properly handle signs
("-0003" would be preferred). Dan's wording is a bit better, I think,
but I'll let people debate the exact wording on the tracker.
ChrisA
More information about the Python-list
mailing list