Situatie
The special syntax *args in function definitions in python is used to pass a non-key worded, variable-length argument list to a function.
The syntax is to use the symbol * to take in a variable number of arguments; by convention, it is used with the word args.
Solutie
Pasi de urmat
# *args for variable number of arguments
def myFun(*argv):
for arg in argv:
print (arg)
myFun(‘This’, ‘is’, ‘a’, ‘test’)
Output:
This
is
a
test
Leave A Comment?