Re: Negative integers and string formating

2006-10-23 Thread Steven D'Aprano
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

Re: Negative integers and string formating

2006-10-23 Thread Paul Rubin
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

Re: Negative integers and string formating

2006-10-23 Thread Brett Hoerner
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