python 动态传参
程序员文章站
2022-04-08 16:06:43
...
def func (**.kwargs):
print(kwargs)
func(a=1,b=2,haha='哈哈',hehe='呵呵')
{‘a’: 1, ‘b’: 2, ‘haha’: ‘哈哈’, ‘hehe’: ‘呵呵’}
def func(*args):
print(args)
func('a','b','c','1','2',3,'ds',123)
(‘a’, ‘b’, ‘c’, ‘1’, ‘2’, 3, ‘ds’, 123)
传参顺序: 位置参数,*args, 默认参数 ,***kwargs