Chinaunix
标题:
如何将list中数据变成类似def foo(*arg)函数的输入
[打印本页]
作者:
yuntinghill
时间:
2009-06-08 22:49
标题:
如何将list中数据变成类似def foo(*arg)函数的输入
函数形式是def foo(*arg)
即可以这样调用foo(1,2,3,...)
现在有一list =[1,2,3]或者[1,2,3,4,...]
想将list中所包含的item作为foo的输入参数
如何才能比较简便的实现
作者:
xiaoyu9805119
时间:
2009-06-09 09:28
>>> a = [1,2,33]
>>> foo(*a)
作者:
yuntinghill
时间:
2009-06-09 20:35
thanks
作者:
nietsche
时间:
2009-06-09 21:07
haha!
欢迎光临 Chinaunix (http://bbs.chinaunix.net/)
Powered by Discuz! X3.2