Negative integers and string formating

Brett Hoerner bretthoerner at gmail.com
Tue Oct 24 03:54:51 CEST 2006


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




More information about the Python-list mailing list