[Tutor] Is this a job for zip(), or some other way?
R. Alan Monroe
amonroe at columbus.rr.com
Fri Mar 26 08:52:47 EST 2004
>> > >>> zip(*[ ('bob', 24, 457), ('mike', 20, 4567), ('steve', 30, 576)])
>> >[('bob', 'mike', 'steve'), (24, 20, 30), (457, 4567, 576)]
> What was gained with the *?
> Is it that if you have:
> L = [ ('bob', 24, 457), ('mike', 20, 4567), ('steve', 30, 576)]
> You can then zip(*L) ?
> Or is there something else?
I'd like to know too how the * does what it does here. It works, but I
can't tell WHY it works.
Alan
More information about the Tutor
mailing list