我需要创建一个函数,它可以:
我试着用检查.getargspec()但似乎应该在函数外部调用它。有什么建议吗?在
以下是伪代码: 定义此函数:
def set_global(a1, a2, a3, .... an):
#the number of arguments is not fixed and we need to detect that
for old_input in total input:
new_input_name=str(old_input.name)+'_in'
global new_input_name
new_input_name = old_input.value
我真的认为您在寻找
globals
函数。在你可以把它放到一个函数中:
^{pr2}$可以这样称呼:
但是,老实说,我真的不认为这是个好主意。。。在
我们可以使用
^{pr2}$globals()
来执行您想要的操作:因此,使用Python交互式解释器中的上述函数:
相关问题 更多 >
编程相关推荐