Can string format operator help me?

Srihari Vijayaraghavan harisri at bigpond.com
Fri May 10 16:52:49 EDT 2002


Hello Martin and Skip,

Martin v. Löwis wrote:
> You should use '%6d' for that.
> 
> Regards,
> Martin

Skip Montanaro wrote:
> How about:
> 
>>>> i = 1
>>>> while i <= 1000000:
> ...   print "%7d" % i
> ...   i *= 10
> ...
>       1
>      10
>     100
>    1000
>   10000
>  100000
> 1000000
> 

Thanks for your help. Now I understand the idea.

-- 
Hari.
harisri at bigpond.com



More information about the Python-list mailing list