Python Pass Dict as Function Params

March 5, 2020
Use ** to unpack dict
data = {
    'name': 'Desmond',
    'age': 40
}

def greet(name = None, age = None):
    print(f"Hello {name} ({age})")

greet(**data)
This work is licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License.