Problem with string format
Mensanator
mensanator at aol.com
Wed Mar 11 01:18:24 EDT 2009
On Mar 11, 12:07 am, Mike314 <michae... at gmail.com> wrote:
> Hello,
>
> I have a strange problem with the string format:
>
> >>> '%s %s %s %s %s' % ['01', '02', '03', '04', '05']
>
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> TypeError: not enough arguments for format string
>
> But as soon I use tuple it is working:>>> '%s %s %s %s %s' % ('01', '02', '03', '04', '05')
>
> '01 02 03 04 05'
>
> What is the problem and how can I still use list?
>>> '%s %s %s %s %s' % tuple(['01', '02', '03', '04', '05'])
'01 02 03 04 05'
>
> Thanks.
More information about the Python-list
mailing list