Is there any nice way to unpack a list of unknown size??
fredrik at pythonware.com
Sun Sep 14 21:39:29 CEST 2008
srinivasan srinivas wrote:
> I want to do something like below:
> 1. first, second, third, *rest = foo
> 2. for (a,b,c,*rest) in list_of_lists:
update to Python 3.0 (as others have pointed out), or just do
first, second, third = foo[:3]
rest = foo[3:]
for item in list_of_lists:
a, b, c = item[:3]
rest = item[3:]
and move on to more interesting parts of your program.
More information about the Python-list