結果: ...
def foo(*args, **kwargs):
print(args, kwargs)
1 foo(x=1) 2 foo(1) 3 foo({"x": 1}) 4 foo(**{"x": 1}) dic = {"x": 1} 5 foo(dic) 6 foo(**dic)
結果:
1 () {'x': 1} 2 (1,) {} 3 ({'x': 1},) {} 4 () {'x': 1} 5 ({'x': 1},) {} 6 () {'x': 1}
結果: ...
def foo(*args, **kwargs):
print(args, kwargs)
1 foo(x=1) 2 foo(1) 3 foo({"x": 1}) 4 foo(**{"x": 1}) dic = {"x": 1} 5 foo(dic) 6 foo(**dic)
結果:
1 () {'x': 1} 2 (1,) {} 3 ({'x': 1},) {} 4 () {'x': 1} 5 ({'x': 1},) {} 6 () {'x': 1}