本文共 1034 字,大约阅读时间需要 3 分钟。
def show (*arg): print(arg)show(1)show(1,2)show('hello','world','!!!')##################################################(1,)(1, 2)('hello', 'world', '!!!')
def show(**arg): print(arg)show(o1=2)show(one=2, two='je')show(one='hello', two='world', three='!!!')##################################################{ 'o1': 2}{ 'one': 2, 'two': 'je'}{ 'one': 'hello', 'two': 'world', 'three': '!!!'}
把代码改了改,
def show(**arg): print(arg.get('two')) print(arg.get('ones', 'None')) print(arg['three'])show(one='hello', two='world', three='!!!')#############################################################worldNone!!!
转载地址:http://eatzb.baihongyu.com/