Passing all arguments of a function to another function

后端 未结 3 974
迷失自我
迷失自我 2020-12-02 21:47

I want to pass all the arguments passed to a function(func1) as arguments to another function(func2) inside func1 This can be done wit

3条回答
  •  时光取名叫无心
    2020-12-02 22:23

    Provided that the arguments to func1 are only keyword arguments, you could do this:

    def func1(a=1, b=2, c=3):
        func2(**locals())
    

提交回复
热议问题