Python将列表列表转换为元组列表 [英] Python Convert a list of list to list of tuples

查看:577
本文介绍了Python将列表列表转换为元组列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用Python将列表列表转换为元组列表.但是我不想重复遍历嵌套列表,因为这样做会增加脚本的执行时间.有什么办法可以帮我锻炼吗?

I want to convert a list of list into list of tuples using Python. But I want to do it without iterating through the nested list as it will increasing execution time of script. Is there any way which can workout for me?

预先感谢

推荐答案

converted_list = [tuple(i) for i in nested_list]

这篇关于Python将列表列表转换为元组列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆