printing sequences

John J. Lee phrxy at
Fri Jun 1 16:35:39 CEST 2001

I've just had an attack of boredom about this simple problem that's been
annoying me for a bit.  I suspect there must be a simple solution, but I
can't think what it is at the moment:

t = (1.34, 2.02, 2.3)
l = [1.34, 2.02, 2.3]

print "foo: %s, bar %s" % t, l

Which, of course, produces long strings with spurious precision where the
sequences contain floating point numbers having no exact binary

It's very convenient to be able to print sequences, but can anyone tell me
what simple construction I'm missing, or, if there is no such thing,
supply the needed function that somebody surely must have written


More information about the Python-list mailing list