Right-Justifying Numeric Output

Rich Shepard rshepard at appl-ecosys.com
Thu Jan 25 17:34:31 EST 2007


On Thu, 25 Jan 2007, hg wrote:

> assuming max size = 10
>
> #with spaces
>>> '% 10d' % 11
> '        11'
> #with zeros
>>> '%010d' % 11
> '0000000011'

   Thank you very much! I didn't see this in any of my Python books or on the
Web.

Rich

-- 
Richard B. Shepard, Ph.D.               |    The Environmental Permitting
Applied Ecosystem Services, Inc.        |          Accelerator(TM)
<http://www.appl-ecosys.com>     Voice: 503-667-4517      Fax: 503-667-8863



More information about the Python-list mailing list