<分区>
我有一个函数
def wrapper_function(url, **kwargs)
def foo():
if kwargs:
return do_something(url, kwargs)
else:
return do_something(url)
do_something()
函数可以有一个或多个参数。
当我调用 wrapper_function()
时,想像这样调用它
wrapper_function('www.bar.com')
或
wrapper_function('www.bar.com', selected_clients=clients)
这样do_something('www.bar.com', selected_clients=clients)
。
但是,当我这样处理时,我得到了一个错误
未定义客户端
。
我如何才能像使用关键字一样将参数传递给内部函数?重要的是,该关键字也需要可变。