Reference:

  1. Understanding kwargs in Python


def print_keyword_args(**kwargs):
    # kwargs is a dict of the keyword args passed to the function
    for key, value in kwargs.iteritems():
        print "%s = %s" % (key, value)
        # output:
        # first_name = Bobby
        # last_name = Smith

#1
print_keyword_args(first_name="John", last_name="Doe")

#2
kwargs = {'first_name': 'Bobby', 'last_name': 'Smith'}
print_keyword_args(**kwargs)

results matching ""

    No results matching ""