+ 1
how can I print **dict
Not like this obviously https://code.sololearn.com/cT37o9oiprWq/?ref=app
2 Réponses
+ 4
In order to use **dict with print function you will need to know, what parameter names the print function is using.
Passing dict d:
d = {"a": 1, "b": 4, "c": 9}
to function f:
def f(a, b, c):
return a + b + c
f(**d)
equals:
f(a = 1, b = 4, c = 9)
which in this case equals:
f(1, 4, 9)
and you would get 13 as result.
0
Seb TheS not what I expected but finally what I wanted.
Thanks