[Tutor] Is this a job for zip(), or some other way?

Isr Gish isrgish at fastem.com
Sun Mar 28 01:48:29 EST 2004


Where does this * thing come from I don,t remmember seeing it in the docs.

-----Original Message-----
   >From: "Bob Gailer"<bgailer at alum.rpi.edu>
   >Sent: 3/25/04 8:45:40 PM
   >To: "tutor at python.org"<tutor at python.org>
   >Subject: Re: [Tutor] Is this a job for zip(), or some other way?
   >
   >At 06:16 PM 3/25/2004, Gregor Lingl wrote:
   >
   >
   >>Bob Gailer schrieb:
   >>
   >>>....
   >>> >>> apply(zip, [ ('bob', 24, 457), ('mike', 20, 4567), ('steve', 30, 576)])
   >>>[('bob', 'mike', 'steve'), (24, 20, 30), (457, 4567, 576)]
   >>>
   >>This works also:
   >>
   >> >>> zip(('bob', 24, 457), ('mike', 20, 4567), ('steve', 30, 576))
   >>[('bob', 'mike', 'steve'), (24, 20, 30), (457, 4567, 576)]
   >>
   >>So in your case
   >>
   >> >>> zip(*[ ('bob', 24, 457), ('mike', 20, 4567), ('steve', 30, 576)])
   >>[('bob', 'mike', 'steve'), (24, 20, 30), (457, 4567, 576)]
   >
   >Yah, Ich habe geschrieben und Zie Zind correct. I was trying to remember 
   >the * approach, my head would not deliver it in time.
   >
   >Bob Gailer
   >bgailer at alum.rpi.edu
   >303 442 2625 home
   >720 938 2625 cell 
   >

All the best

Isr




More information about the Tutor mailing list