I have searched but only found items showing leading zeros, not this edge case: I need to have the equivalent of Excel's # in a number format, (which results in 0 displaying a result of zero length, or empty string)
if I do
i = 0
'{}{:02}'.format('prefix', i)
I get
prefix00
(as expected from PEP 3101), however specifying a width of 0 does not produce what I need. which is something like
i = 0
'{}{:0}'.format('prefix', i)
to produce
prefix
rather than
prefix0
as I currently get. Is this inconsistent in the string format function? Is there a way to create this in the format specifier (rather than a explicit test for zero?)