Slight correction.
" %d" % 123 is not quite equivalent to str(123) as it does not handle
negative numbers the same way.
I am not sure there is a simple direct equivalent.
"%+d" % 123 --> "+123" always gives a sign.
"%4d" % 123 --> " 123"
"%4d" % -123 --> "-123"  so this works if you you know how wide the
number is.

This might be a little too tricky.
[" %d", "%d][n < 0] % n  --> selects list[0] or list[1] based upon sign
of number

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

Reply via email to