#把函数当作参数传给另一个函数:
def foo(n):
print(n)
def bar (name):
print("my name is %s" %name)
# foo(bar)
foo(bar('alex'))
#把函数当作参数传给另一个函数:
def foo(n):
print(n)
def bar (name):
print("my name is %s" %name)
# foo(bar)
foo(bar('alex'))
转载于:https://www.cnblogs.com/huangjinshan/p/6238495.html