why 'double tuple' when using %s with print?
jkndeja at my-deja.com
jkndeja at my-deja.com
Thu Nov 9 11:32:58 EST 2000
Hello there
Here's a relatively simple question. If t is a tuple
>>> t = (1,2)
then I can print it with
>>> print t
to get the result. If I want to print is using the '%' operator,
I try
>>> print "my tuple is %s" % t
but this gives me
TypeError: not all arguments converted
and I have to use
>>> print "my tuple is %s" % (t,)
to get what I expect.
Shurely, since t is already a tuple, it shouldn't need to be converted
into a 'tuple of tuples'?
Thanks for any explanation
Sent via Deja.com http://www.deja.com/
Before you buy.
More information about the Python-list
mailing list