[Tutor] Group sequence pairwise

Christopher Arndt chris.arndt at web.de
Tue Feb 27 18:14:12 CET 2007


Justin Ezequiel schrieb:
>>>> a = list('asdfg')
>>>> map(None, a[::2], a[1::2])
> [('a', 's'), ('d', 'f'), ('g', None)]
>>>> a = list('asdfgh')
>>>> map(None, a[::2], a[1::2])
> [('a', 's'), ('d', 'f'), ('g', 'h')]

That's clever! Thanks!

Chris


More information about the Tutor mailing list