嘿,我正在用 python 2.6 编写一个小程序,我已经定义了 2 个辅助函数,几乎可以满足我的所有需求,例如
def helper1:
...
def helper2:
...
现在我的问题是我想创建一个新函数,将这两个函数集中在一个函数中,这样我就不必编写(在 shell 中):
list(helper1(helper2(argument1,argument2)))
而是只是
function(argument1,argument2)
有什么捷径吗?我是 Python 的新手,还是您需要更多代码示例才能回答?
提前感谢任何提示或帮助
最佳答案
def function(arg1, arg2):
return list(helper1(helper2(arg1, arg2)))
应该可以。
关于python - 在 Python 语法中调用函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4275764/