multiple assignment

Anand anand.chittu at gmail.com
Thu Mar 23 00:13:06 EST 2006


>> Wouldn't it be nice to say
>> id, *tokens = line.split(',')
>
>
> id, tokens_str = line.split(',', 1)

But then you have to split tokens_str again.

id, tokens_str = line.split(',', 1)
tokens = tokens_str.split(',')

this is too verbose.

anand




More information about the Python-list mailing list