Tabii bu argümanları almak için **'lı bir parametre

gerekecektir.
This commit is contained in:
Mert Gör ☭ 2023-05-24 15:33:08 +03:00
parent 21295bc997
commit 5058cc8c25
No known key found for this signature in database
GPG Key ID: 2100A876D55B39B9
1 changed files with 5 additions and 0 deletions

View File

@ -0,0 +1,5 @@
def foo(a, b, c, d, e, **f):
print("a = {}, b = {}, c = {}, d = {}, e = {}, f = {}".format(a, b, c, d, e, f))
d = {'c': 30, 'd': 40, 'e': 50, 'x': 100, 'y': 200}
foo(10, 20, **d) # a = 10, b = 20, c = 30, d = 40, e = 50, x = 100, y = 200