python—有没有办法传递一个需要 args 的函数,而不需要 args 并在以后添加它们?
发布时间:2022-08-27 03:41:07 393
相关标签: # python
python中是否有一种简单的方法可以将需要args的函数作为没有args的参数传递,并在目标函数中添加te args?我在想类似的东西:
def add(a,b):
return a + b
def multiply(a,b):
return a * b
def destination(variable, func):
c = 5
d = 3
e = func(c , d) * variable
return e
s = 10
output1 = destination(s, add())
output2 = destination(s, multiply())
特别声明:以上内容(图片及文字)均为互联网收集或者用户上传发布,本站仅提供信息存储服务!如有侵权或有涉及法律问题请联系我们。
举报