Created
November 23, 2015 09:12
-
-
Save bngsudheer/5959a9cdcb64fbfdfc5c to your computer and use it in GitHub Desktop.
Pass keyword arguments using a dictionary
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# You can nicely pass the dictionary items as keyword arguments | |
def my_function(a, b, c): | |
print a, b, c | |
# Pass keyword arguments | |
my_function(a=10, b=20, c=30) | |
args_dict = {'a': 100, 'b': 200, 'c':300} | |
# Pass keyword arguments using a dictionary | |
# The dictionary keys map to names of the keyword arguments | |
my_function(**args_dict) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment