Right-Justifying Numeric Output

Rich Shepard rshepard at appl-ecosys.com
Thu Jan 25 22:46:59 CET 2007


   I have this print statement in a function:

print '%2d   $%11.2f  $%10.2f  $%9.2f  $%9.2f' %(nper, pv, diff, ten, bonus)

and I would like to have the output right justified in the specified field.
My trials using .rjust(n) have produced that string in the output, not the
intended results. Is there a way of right justifying numeric output?

Thanks,

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