首页 > 解决方案 > 从多个列表中一一提取值并存储到新的 LIST - Python

问题描述

从多个列表中一一提取值并存储到新的 LIST - Python

List1 = ('1', '2','3','4')

List2 = ('one', 'two','three','four')

List3 = ('1-1', '1-2','1-3','1-4')



output_list = ('1,one,1-1', '2,two,1-2','3,three,1-3','4,four,1-4')

标签: python

解决方案


你可以使用邮编

List1 = ('1', '2','3','4')

List2 = ('one', 'two','three','four')

List3 = ('1-1', '1-2','1-3','1-4')

output_list = [f'{l1},{l2},{l3}' for l1, l2, l3 in zip(List1, List2, List3)]

推荐阅读