[Tutor] Group sequence pairwise

Justin Ezequiel justin.mailinglists at gmail.com
Tue Feb 27 02:32:23 CET 2007


>>> 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')]
>>>


More information about the Tutor mailing list