print format
William Tanksley
wtanksle at dolphin.openprojects.net
Tue Jul 25 20:56:16 EDT 2000
On Tue, 25 Jul 2000 17:47:44 -0700, Curtis Jensen wrote:
>I don't know if this is possible in python but, Is there a way to repeat
>a format command a spceified number of times? For example, in Fortran
>there is the format code "20I5" Which is the same as "I5" twenty
>times. I want something like:
>print '20(%i5) ' % [list of 20 intgers]
Perhaps
print (20*"%5i ") % [list of 20 integers]
will work for you. The multiplier on the string repeats it 20 times.
This lets you do things like:
list = [list of 'n' integers]
print (len(list)*"%5i ") % list
>Also, how do I print without a new line other than using
>sys.stdout.write?
Why? Is there something in specific you're trying to avoid? (Yes, it's
possible, but it's not pretty.)
>Curtis Jensen
--
-William "Billy" Tanksley
More information about the Python-list
mailing list