标签:
当你要传递的参数已经是一个列表,调用的函数却接受分开一个个的参数,这个时候可以考虑参数列表拆分:
args=[3,6] x=list(range(*args)) print x
-------------------输出-----------------------------
[3, 4, 5]
def parrot(voltage,state=‘a stiff‘,action=‘voom‘): print "-- This parrot wouldn‘t ",action, print "if you put ",voltage,"volts through it.", print "E‘s",state,"!" d={"voltage":"four million", "state":"bleedin demised","action":"voom"} parrot(**d)
-------------------输出-----------------------------
-- This parrot wouldn‘t voom if you put four million volts through it. E‘s bleedin demised !
标签:
原文地址:http://www.cnblogs.com/nzyjlr/p/4704044.html