python - 从多个列表中一一提取值并存储到新的 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')
解决方案
你可以使用邮编
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)]
推荐阅读
- haskell - Haskell 嵌套列表
- javascript - 创建系统以给 3 名员工点数,每次我点击其中一个按钮时,我给选定的用户 1 点-
- python - 如何在函数中使用类变量?
- cucumber - 黄瓜中的功能文件设置
- xml - 收到的 XML 响应是乱码
- rest - 在消费者端处理Kafka流时调用外部REST API
- javascript - 阻止 UserScript 自动单击
- python - koalas groupby -> apply 返回'无法插入“key”,已经存在'
- javascript - 在反应中检查来自firebase的用户名可用性
- java - 在第 96 行获取一个非常大的异常错误 Java、Eclipse 错误