python - Combine lists by joining strings with matching index values -
i have 2 lists combine, instead of increasing number of items in list, i'd join items have matching index. example:
list1 = ['a', 'b', 'c'] list2 = ['1', '2', '3'] list3 = ['a1', 'b2', 'c3']
i've seen quite few other questions combining 2 lists, i'm afraid haven't found achieve.
any appreciated. cheers.
>>> list1 = ['a', 'b', 'c'] >>> list2 = ['1', '2', '3'] >>> map(lambda a, b: + b, list1, list2) ['a1', 'b2', 'c3']
Comments
Post a Comment