简体   繁体   中英

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

归功于@WillemVanOnsem:

output = tuple(zip(lst1,lst2))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM