python *args **kwags code example
Example 1: args kwargs python
>>> def argsKwargs(*args, **kwargs):
... print(args)
... print(kwargs)
...
>>> argsKwargs('1', 1, 'slgotting.com', upvote='yes', is_true=True, test=1, sufficient_example=True)
('1', 1, 'slgotting.com')
{'upvote': 'yes', 'is_true': True, 'test': 1, 'sufficient_example': True}
Example 2: what are args and kwargs in python
def info(**kwargs):
for key, value in kwargs.items():
print ("%s == %s" %(key, value))
info(first ='This', mid ='is', last='Me')