python形参的使用
# 命名关键字形参,*后面就是命名关键字形参,(可以是*args)
def func(a, b. *, x, y):
pass
# 形参混用的顺序:位置形参,默认形参,*args,命名关键字星饭,**kwargs
def func(x, y=111, *args, z, **kwargs):
print(x, y, args, z, kwargs)
![](https://img2020.cnblogs.com/blog/1641860/202005/1641860-20200521192706189-95219611.png)
# 命名关键字形参,*后面就是命名关键字形参,(可以是*args)
def func(a, b. *, x, y):
pass
# 形参混用的顺序:位置形参,默认形参,*args,命名关键字星饭,**kwargs
def func(x, y=111, *args, z, **kwargs):
print(x, y, args, z, kwargs)
![](https://img2020.cnblogs.com/blog/1641860/202005/1641860-20200521192706189-95219611.png)