Is there any nice way to unpack a list of unknown size??

Gary Herron gherron at islandtraining.com
Sun Sep 14 11:08:08 EDT 2008


srinivasan srinivas wrote:
> I want to do something like below:
>
> 1. first, second, third, *rest = foo
>   

Python 3.0 has exactly this feature.  No current Python 2.x version has it.

Gary Herron

>  2. for (a,b,c,*rest) in list_of_lists:
>
> Please suggest.
>
> Thanks,
> Srini
>
>
>       Bring your gang together. Do your thing. Find your favourite Yahoo! group at http://in.promos.yahoo.com/groups/
> --
> http://mail.python.org/mailman/listinfo/python-list
>   




More information about the Python-list mailing list