On Thu, Mar 17, 2016 at 5:53 AM, Ben Finney <[email protected]> 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
--
https://mail.python.org/mailman/listinfo/python-list