Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
lambda xxxx: a/b
我在有 x 的地方放什么,如何在 lambda 中使用*args和?**kwargs是否可以?
*args
**kwargs
这是不可能的。最好的解决方案是使用具有*args和可能的功能**kwargs:
argsneeded = ['foo', 'bar'] def whatever(**kwargs): if not all(x in kwargs for x in argsneeded): raise ValueError('required kwarg is missing')