0
的元組,我想兩個清單合併成兩個元Python的合併兩個列表成爲兩個元
lst1 = [1,2,3,4,5]
lst2 = ['one','two','three','four','five']
所需輸出的元組:
tup_of_2_tups = ((1,'one'),(2,'two'),(3,'three'),
(4,'four'),(5,'five'))
的元組,我想兩個清單合併成兩個元Python的合併兩個列表成爲兩個元
lst1 = [1,2,3,4,5]
lst2 = ['one','two','three','four','five']
所需輸出的元組:
tup_of_2_tups = ((1,'one'),(2,'two'),(3,'three'),
(4,'four'),(5,'five'))
信貸@WillemVanOnsem:
output = tuple(zip(lst1,lst2))
'元組(zip(lst1,lst2))'。 –
@WillemVanOnsem:您應該將其作爲答案發布 – Dalvenjia