681 B
681 B
+++ date="2022-12-24" author="spanskiduh" title="python_specifics" description="click to read python_specifics" +++
PYTHON SPECIFICS
*args and **kwargs
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