Negative integers and string formating

Brett Hoerner bretthoerner at gmail.com
Mon Oct 23 21:54:51 EDT 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