python-3.x - Python:函数调用作为参数
问题描述
我想做一个函数:
def func (model_name = 'abc', **kwargs):
model = model_name (**kwargs)
model.do_something ()
因此模型将根据参数的值创建model_name
。
解决方案
推荐阅读
- javascript - 如何将 PHP 变量的 while 循环作为 JSON 组件传递到 JS 脚本中?
- javascript - 使用 window.open 的跨域对象上的 SecurityError
- multithreading - 是否可以通过 Windows 中的信号、事件等子线程(从通知处理程序开始)停止或中断主线程
- c# - 如何使用linq从实体框架中的当前值中减去以前的记录值
- r - 如何更改固定列颜色并在 DT::datatable Shiny 中显示 POSIXct 数据?
- reactjs - 真的可以展平从 graphql 查询返回的数据吗?
- reactjs - Uncaught (in promise) TypeError: raget 不是 Reactjs 中的函数
- visual-studio - 从源代码管理中获取代码时,有没有办法限制 Visual Studio 使用的带宽?
- html - 导航栏图标与超链接标签分离
- java - 如何在java中的方法中创建和返回枚举