码迷,mamicode.com
首页 > 其他好文 > 详细

回调函数

时间:2018-12-06 17:58:02      阅读:116      评论:0      收藏:0      [点我收藏+]

标签:回调   int   col   color   class   参数   nbsp   值传递   []   

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

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)

 

回调函数

标签:回调   int   col   color   class   参数   nbsp   值传递   []   

原文地址:https://www.cnblogs.com/liangliangzz/p/10077160.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!