On Thu, 2007-09-06 at 02:47 +0000, [EMAIL PROTECTED] wrote:
> I might just be being dumb tonight, but why doesn't this work:
>
> >>> '%s aaa %s aa %s' % ['test' for i in range(3)]
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> TypeError: not enough arguments for format string
To format multiple objects, the right operand must be a tuple. A list is
not a tuple, so '%' only sees one argument. You want something like
this:
>>> '%s aaa %s aa %s' % tuple('test' for i in range(3))
'test aaa test aa test'
HTH,
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list