Printing strings

Alex alex at somewhere.round.here
Tue Nov 2 19:41:25 CET 1999


> I'm trying to do something like the following:
> 
> a=4.0
> b=2.0
> print '2(%3.1f)' % a,b
> 
> where I really mean
> 
> print '%3.1f %3.1f' % a,b

You could use

print string.join(2*['%3.1f'])%(a,b)

I suppose.

Alex.




More information about the Python-list mailing list