For example, I have following two lists
listA=[\'one\', \'two\' , \'three\'] listB=[\'apple\',\'cherry\',\'watermelon\']
How can I pair those two lists to
The easiest solution would be to simply use zip
as in:
>>> listA=['one', 'two' , 'three']
>>> listB=['apple','cherry','watermelon']
>>> list(zip(listA, listB))
[('one', 'apple'), ('two', 'cherry'), ('three', 'watermelon')]
I guess it would be possible to use map
and lambdas, but that would just needlessly complicate things as this is really the ideal case for zip
.