需求总结
1)函数的名字可以当作参数使用
2)如果一个函数的名字被当作参数使用 哪个这个函数就是回调函数
认识回调函数
回调函数 不是说这个函数有什么特别之处 只是被当作参数使用而已
回调函数的作用
通知作用让程序设计变得灵活提高效率定时执行示例
def playMusic(): print( 此处写播放音乐的代码 ) import threading timer threading.Timer(3,playMusic) timer.start()
按学号中的班级排序
lst [ 2021020003 , 2021010001 , 2021011002 , 2021031005 ] def byClass(xuehao): return xuehao[4:6] ret sorted(lst,key byClass) print(ret)
同步异步回调
回调地狱



