spanskiblog/content/posts/python_specifics.md

688 B

+++ date="2022-12-24" author="spanskiduh" title="python_specifics" description="click to read about python_specifics" +++

PYTHON SPECIFICS

*args and **kwargs

reference

args

def myFun(*argv):
    for arg in argv:
        print(arg)
 
 
myFun('Hello', 'Welcome', 'to', 'GeeksforGeeks')
Hello
Welcome
to
GeeksforGeeks

kwargs

They are basically named args in dict


def myFun(**kwargs):
    for key, value in kwargs.items():
        print("%s == %s" % (key, value))
 
 
# Driver code
myFun(first='Geeks', mid='for', last='Geeks')
first == Geeks
mid == for
last == Geeks