当前位置: 代码迷 >> 综合 >> python3中的缺省参数和命名参数
  详细解决方案

python3中的缺省参数和命名参数

热度:80   发布时间:2024-01-24 14:30:03.0
def test(a,b):result=a+bprint("result=%d"%(a+b))test(11,22)test(11,1)test(22,1)def test1(a,b=1):#b=1 是一个缺省参数result=a+bprint("result=%d"%(a+b))test1(11)test1(11,b=22) #此处b=22 是一个命名参数