Zip with sequences of diffrent length

Mike C. Fletcher mcfletch at rogers.com
Mon Apr 26 13:04:43 EDT 2004


Use map( None, l, l[1:] )

HTH,
Mike

Nickolay Kolev wrote:
...

> Wanted tuples:
>
> (1, 2)
> (2, 3)
> (3, None)
>
> I can get the first two tuples using zip(l, l[1:]). How do I get the 
> last one?

...
_______________________________________
  Mike C. Fletcher
  Designer, VR Plumber, Coder
  http://members.rogers.com/mcfletch/






More information about the Python-list mailing list