looping throuhg a list 2 items at a time

Andrae Muys amuys at shortech.com.au
Thu Apr 11 02:51:31 EDT 2002


"dsavitsk" <dsavitsk at e-coli.net> wrote in message news:<C25t8.5982$d7.1714559 at newssrv26.news.prodigy.com>...
> I guess this proves TMTOWTDI.

Which is a Tautology, but is it also obvious? :)

Andrae

> "Emile van Sebille" <emile at fenx.com> wrote in message
> news:%34t8.36244$CU.41218 at rwcrnsc51.ops.asp.att.net...
> > >>> for x,y in [(x,y) for x,y,z in zip(l,l[1:],[1,0]*len(l)) if z]:
> > ...     print x,y



More information about the Python-list mailing list