+ 3
How to take unlimited number of function arguments?
--
5 Respuestas
+ 7
def f(*args, **kwargs):
print(args)
print(kwargs)
f(1, 2, 'a', [], a=1, b=2, c=3)
+ 3
Which language?
+ 3
def fun(**kwargs):
print("kwargs")
# kwargs is keyword argument in which we give multiple arguments
+ 2
+ 1
* is real gold. It also allows you to put iterables as a sequences of arguments.
func(*[1, 4, 27]) = func(1, 4, 27)