fork download
  1. def test(**kwargs):
  2. kwargs.pop('a', None)
  3. kwargs.pop('b', None)
  4. print(kwargs)
  5.  
  6. test(a=1, b=2, c=3)
  7. x = {'a':1, 'b':2, 'c':3}
  8. test(kwargs=x)
  9. test(**x)
  10. print(x)
  11. test(x)
Runtime error #stdin #stdout #stderr 0.02s 9944KB
stdin
Standard input is empty
stdout
{'c': 3}
{'kwargs': {'c': 3, 'b': 2, 'a': 1}}
{'c': 3}
{'c': 3, 'b': 2, 'a': 1}
stderr
Traceback (most recent call last):
  File "./prog.py", line 11, in <module>
TypeError: test() takes 0 positional arguments but 1 was given