Python:解包到未知数量的变量? [英] Python: unpack to unknown number of variables?
本文介绍了Python:解包到未知数量的变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何解开一个未知的元组,比如说一个列表?
我有一个列的数据,它们被拆分成一个元组一些功能。我想解开这个元组的变量,但我不知道有多少列我会有。
感谢您的帮助:)
l = list(t)
How could I unpack a tuple of unknown to, say, a list?
I have a number of columns of data and they get split up into a tuple by some function. I want to unpack this tuple to variables but I do not know how many columns I will have. Is there any way to dynamically unpack it to as many variables as I need?
Thanks for your help :)
解决方案
Unpack the tuple to a list?
l = list(t)
这篇关于Python:解包到未知数量的变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文