On Mon, 23 Oct 2006 18:56:21 -0700, Paul Rubin wrote:
> Steven D'Aprano <[EMAIL PROTECTED]> writes:
>> def display(**kwargs):
>> fs = format(kwargs['argument'])
>> return fs % kwargs
>
> def display(**kwargs):
> fs = format(kwargs['argument'])
> return fs % dict((x, abs(y)) for
Steven D'Aprano <[EMAIL PROTECTED]> writes:
> def display(**kwargs):
> fs = format(kwargs['argument'])
> return fs % kwargs
def display(**kwargs):
fs = format(kwargs['argument'])
return fs % dict((x, abs(y)) for x,y in kwargs.iteritems())
--
http://mail.python.org/mailman/listi
Steven D'Aprano wrote:
> Are there any string formatting codes that will place a space between the
> sign and the number?
Not that I know of, why not use the absolute value (after checking if
it is negative),
In [1]: abs(-1)
Out[1]: 1
--
http://mail.python.org/mailman/listinfo/python-list