Printing strings

Matthew Hirsch meh9 at cornell.edu
Tue Nov 2 10:18:59 EST 1999


Hi All,

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

but it's printing

2(4.0) 2.0

Is there a way of doing this so I don't have to write out %3.1f,
multiple times?

Thanks,
Matt






More information about the Python-list mailing list