On Tue, Jul 12, 2016, at 02:21, Steven D'Aprano wrote: > If not, then what are the alternatives? Using str.format, how would > you get the same output as this? > > > py> "%8.4d" % 25 > ' 0025'
" %04d" % 25 "%8s" % ("%04d" % 25) The latter (well, generally, "format it how you want and then use %*s to put it in fixed columns") is something that I've actually *done*, because it's easier to reason about. -- https://mail.python.org/mailman/listinfo/python-list