mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-11-23 06:03:07 +03:00
Fix wrong method name in comment
This commit is contained in:
parent
6a5b626f78
commit
c3b9c3c31d
@ -436,9 +436,9 @@ all_the_args(1, 2, a=3, b=4) prints:
|
|||||||
# 调用可变参数函数时可以做跟上面相反的,用*展开序列,用**展开字典。
|
# 调用可变参数函数时可以做跟上面相反的,用*展开序列,用**展开字典。
|
||||||
args = (1, 2, 3, 4)
|
args = (1, 2, 3, 4)
|
||||||
kwargs = {"a": 3, "b": 4}
|
kwargs = {"a": 3, "b": 4}
|
||||||
all_the_args(*args) # 相当于 foo(1, 2, 3, 4)
|
all_the_args(*args) # 相当于 all_the_args(1, 2, 3, 4)
|
||||||
all_the_args(**kwargs) # 相当于 foo(a=3, b=4)
|
all_the_args(**kwargs) # 相当于 all_the_args(a=3, b=4)
|
||||||
all_the_args(*args, **kwargs) # 相当于 foo(1, 2, 3, 4, a=3, b=4)
|
all_the_args(*args, **kwargs) # 相当于 all_the_args(1, 2, 3, 4, a=3, b=4)
|
||||||
|
|
||||||
|
|
||||||
# 函数作用域
|
# 函数作用域
|
||||||
|
Loading…
Reference in New Issue
Block a user