variable length tuple assignment
Chris Rebert
clp2 at rebertia.com
Wed Feb 25 04:41:54 EST 2009
On Wed, Feb 25, 2009 at 1:16 AM, Helmut Jarausch
<jarausch at igpm.rwth-aachen.de> wrote:
> Sorry if this is too simple but I couldn't find.
>
> I vaguely remember there is a means to assign a variable length tuple
> and catch the 'rest' like
>
> S="a,b,c,d"
>
> (A,B,<list of remaining items>) = S.split(',')
In Python 3.0 (IIRC):
A, B, *rest = S.split(',')
Cheers,
Chris
--
Follow the path of the Iguana...
http://rebertia.com
More information about the Python-list
mailing list