variable length tuple assignment

Chris Rebert clp2 at
Wed Feb 25 10:41:54 CET 2009

On Wed, Feb 25, 2009 at 1:16 AM, Helmut Jarausch
<jarausch at> 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(',')


Follow the path of the Iguana...

More information about the Python-list mailing list