Can string format operator help me?
Skip Montanaro
skip at pobox.com
Fri May 10 02:34:12 EDT 2002
Srihari> Please consider the following example:
Srihari> l = 0
Srihari> while l < 1000000:
Srihari> print "%s" % l
Srihari> l = l + 10000
Srihari> What I want to achieve is something like this:
Srihari> 0
Srihari> 10000
Srihari> ..
Srihari> 100000
Srihari> ..
How about:
>>> i = 1
>>> while i <= 1000000:
... print "%7d" % i
... i *= 10
...
1
10
100
1000
10000
100000
1000000
--
Skip Montanaro (skip at pobox.com - http://www.mojam.com/)
"Excellant Written and Communications Skills [required]" - post to chi.jobs
More information about the Python-list
mailing list