On 06/07/2011 03:01 PM, harrismh777 wrote:
Ethan Furman wrote:--> print("Testing %0*i" % (width, 1))The '*' acts as a place holder for the width argument.very nice...
It works for precision as well as width.
wid = 10
prec = 3
num = 123.456789
print "%0*.*f" % (wid, prec, num)
gives you -> 000123.457
(It's the same as the printf() function in C.)
-=- Larry -=-
--
http://mail.python.org/mailman/listinfo/python-list
