Thanks for this trick.

Can I call this as category thermo-NUKE  of list
functions.
-K

--- Jeff Shannon <[EMAIL PROTECTED]> wrote:

> kumar s wrote:
> 
> > Problem:
> > How do i capture every alternative element in list
> a:
> > 
> > I am unable to pump the a,b, and c into keys list
> > and apple, boy,cat into vals list.
> 
> In a sufficiently recent version of Python, you
> should be able to use 
> an extended slice with a stride --
> 
>      keys = a[::2]
>      vals = a[1::2]
> 
> (Note that this is untested, as I don't have a
> recent version of 
> Python handy at the moment; I'm on 2.2 here, which
> doesn't have 
> extended slices.)
> 
> Jeff Shannon
> Technician/Programmer
> Credit International
> 
> 
> _______________________________________________
> Tutor maillist  -  [email protected]
> http://mail.python.org/mailman/listinfo/tutor
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to