Getting sorting order

Nick Craig-Wood nick at craig-wood.com
Tue Jul 1 23:32:56 CEST 2008


Tobiah <toby at tobiah.org> wrote:
> >>>> master,slave1,slave2=zip(*x)
> 
>  What does the asterisk do here?
> 
>  Thanks
>  ** Posted from http://www.teranews.com **

Instead of passing a single argument x to zip() you can think of it
unpacking the list x and passing len(x) arguments to zip.

So if x = [1,2,3,4]

zip(*x) == zip(1,2,3,4)

-- 
Nick Craig-Wood <nick at craig-wood.com> -- http://www.craig-wood.com/nick



More information about the Python-list mailing list