回调函数

'''
回调函数:可以将函数当做参数进行传递
将函数当做参数传递给另一个函数
'''

def fun1(x):
  print(x)
  x()

def fun2():
  print("fun2")
# fun1(10)
# fun1(1.1)
# fun1([])
# fun1("hello")
# 将fun2函数的返回值传递给fun1的参数 给x
# fun1(fun2())
# 将fun2函数的地址值传递给x
fun1(fun2)
原文地址:https://www.cnblogs.com/liangliangzz/p/10077160.html