convert list of tuples into several lists
Pierre Quentel
quentel.pierre at wanadoo.fr
Fri Feb 11 01:35:43 EST 2005
Steven Bethard a écrit :
> Cappy2112 wrote:
>
>> What does the leading * do?
>
>
> Tells Python to use the following iterable as the (remainder of the)
> argument list:
>
Could someone explain why this doesn't work :
Python 2.3.2 (#49, Oct 2 2003, 20:02:00) [MSC v.1200 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> def f(*args,**kw):
... print args, kw
...
>>> f(*[1,2])
(1, 2) {}
>>> f(*[1,2],x=1)
File "<stdin>", line 1
f(*[1,2],x=1)
^
SyntaxError: invalid syntax
>>>
Pierre
More information about the Python-list
mailing list