Problem with string format

2009-03-10 Thread Mike314
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 "", line 1, in 
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?

Thanks.
--
http://mail.python.org/mailman/listinfo/python-list


Tuple passed to function recognised as string

2009-03-18 Thread Mike314
Hello,

   I have following code:

def test_func(val):
print type(val)

test_func(val=('val1'))
test_func(val=('val1', 'val2'))

The output is quite different:




Why I have string in the first case?

Thanks.
--
http://mail.python.org/mailman/listinfo/python-list