Thursday, July 25, 2019

Python: Replacing kwargs with dict in a function

Say you want to replace the keyword arguments of a fuction with dict object, then do the following:

Sample_Fuction(key1="value1", key2="value2) 

Sample_Dict = {"key1":"value1", "key2":"value2"}

Replace kwargs with Dict:
Sample_Function(**Sample_Dict)

No comments:

Post a Comment