# def add(x=0,y=9):
# return x+y
# s=add(7)
# s=add(y=97)
# s=add(x=6,y=97)
# s=add(12,3)
# s=add(13,y=34)
# s=add(y=2,x=9)
# print(s)
#######################
# def sum(*args):
# sum_=0
# print(type(args))
# for i in args:
# sum_+=i
# return sum_
# print(sum(2,4,3))
def showconfig(**kwargs):
for k,v in kwargs.items():
print("{}={}".format(k,v))
showconfig(k="hhj",ip="110",host="1109999.9.0.9")
# keyword_only:def fn(*x,y)---y是keyword-only
参数规则:
参数列表参数一般顺序是,普通参数、缺省参数、可变位置参数、keyword-only参数(可带缺省值)、可变的关键字参数
# def fn(x,y,z=3,*arg,m=4,n,**kwargs):#keyword-only:*args
# print(x,y,z,m,n)
# print(arg)
# print(kwargs)
#
# fn(1,2,88,90,888,n=94,j=888)
def fn(x,y,z=3,*,m=4,n,**kwargs):#不需要参数,但是又想告诉后面是keyword-only用*
print(x,y,z,m,n)
print(kwargs)