ragardner
ragardner

Reputation: 1975

Python merge two lists into tuple of two tuples

I would like to merge two lists into a tuple of two tuples

lst1 = [1,2,3,4,5]
lst2 = ['one','two','three','four','five']

desired output:

tup_of_2_tups = ((1,'one'),(2,'two'),(3,'three'),
                 (4,'four'),(5,'five'))

Upvotes: 0

Views: 2513

Answers (1)

ragardner
ragardner

Reputation: 1975

credit to @WillemVanOnsem:

output = tuple(zip(lst1,lst2))

Upvotes: 3

Related Questions