In [1]:
def func_kwargs(**kwargs):
print('kwargs: ', kwargs)
print('type: ', type(kwargs))
In [2]:
func_kwargs(key1=1, key2=2, key3=3)
In [3]:
def func_kwargs_positional(arg1, arg2, **kwargs):
print('arg1: ', arg1)
print('arg2: ', arg2)
print('kwargs: ', kwargs)
In [4]:
func_kwargs_positional(0, 1, key1=1)
In [5]:
d = {'key1': 1, 'key2': 2, 'arg1': 100, 'arg2': 200}
In [6]:
func_kwargs_positional(**d)
In [7]:
# def func_kwargs_error(**kwargs, arg):
# print(kwargs)
# SyntaxError: invalid syntax