测试了一下。关于python 的函数def里面的传参数问题:
1、传参顺序:
# codig:utf-8 def function(a,b=1,*args,**kwargs): print(a,‘\n‘,b,‘\n‘,args,‘\n‘,kwargs) a=666 b=520 c= ‘你好‘ d = ‘小白‘ e = ‘小黑‘ f = {‘name‘:‘小李‘,‘age‘:18} function(a,b,c,d,e,f,g=11,h=5,i=‘大哥‘) def func(**kwargs): print(kwargs) func(a=1,b=2,c=5,d=9)
原文地址:https://www.cnblogs.com/wuzaipei/p/9629797.html
时间: 2024-11-01 23:53:32