嘿我正在python 2.6中编写一个小程序,我已经定义了2个辅助函数,它们几乎可以完成我想要的任务,例如
def helper1:
...
def helper2:
...
Run Code Online (Sandbox Code Playgroud)
现在我的问题是我想创建一个新函数,在一个函数中收集两个函数,所以我不必写(在shell中):
list(helper1(helper2(argument1,argument2)))
Run Code Online (Sandbox Code Playgroud)
而是只是
function(argument1,argument2)
Run Code Online (Sandbox Code Playgroud)
那有什么简短的方法吗?我是python的新手,或者你需要更多的代码样本才能回答?
提前填写任何提示或帮助
def function(arg1, arg2):
return list(helper1(helper2(arg1, arg2)))
Run Code Online (Sandbox Code Playgroud)
应该管用.
| 归档时间: |
|
| 查看次数: |
329 次 |
| 最近记录: |