John Posner wrote:
>  Goal: place integer 456 flush-right in a field of width 8
> 
>   Py2: "%%%dd" % 8 % 456
>   Py3: "{0:{1}d}".format(456, 8)
> 
> With str.format(), you don't need to nest one formatting operation
> within another.

With string interpolation, you don't need to do that, either.
>>> '%*d' % (8,456)
'     456'

--
Carsten Haese
http://informixdb.sourceforge.net

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to