Re: problem with string % conversion
Wed, 22 Jun 1994 23:45:51 +0200

> Why is this happening? I thought that the "%s" meant print
> the repr of the object, whatever it is.
> >>> a = ([1,2,3], 'howdy!')
> >>> print "%s" % a
> Traceback (innermost last):
> File "<stdin>", line 1
> TypeError: not all arguments converted

Ehh, except if the object is a tuple. Because at conversion time it
is not known (in general) whether the %s is the only conversion in the
string, the elements of a tuple are distributed one by one over the
conversions. You can use str(a) or (a,) to force a as the only


--Guido van Rossum, CWI, Amsterdam <>
URL: <>