Answers for "python dict to kwargs"

14

python dict to kwargs

func(**{'type':'Event'})

# ^ is equivalent to v

func(type='Event')
Posted by: Guest on May-13-2021
0

python *args to dict

def func(arg1, arg2, arg3=3, arg4=4):
    print(locals())

func(1, 2)

# {'arg3': 3, 'arg4': 4, 'arg1': 1, 'arg2': 2}
Posted by: Guest on September-07-2020

Python Answers by Framework

Browse Popular Code Answers by Language