pairwise combination of two lists

Paul Rubin no.email at nospam.invalid
Thu Aug 18 09:18:49 CEST 2011


Yingjie Lin <Yingjie.Lin at mssm.edu> writes:
> li1 = ['a', 'b']
> li2 = ['1', '2']
>
> and I wish to obtain a list like this
> li3 = ['a1', 'a2', 'b1', 'b2']

from itertools import *

li3 = list(chain.from_iterable(izip(li1,li2)))



More information about the Python-list mailing list