🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
## 函数的嵌套调用 ~~~ def testB(): print('---- testB start----') print('这里是testB函数执行的代码...(省略)...') print('---- testB end----') def testA(): print('---- testA start----') testB() print('---- testA end----') testA() ~~~ 结果: ~~~ ---- testA start---- ---- testB start---- 这里是testB函数执行的代码...(省略)... ---- testB end---- ---- testA end---- ~~~ #### 小总结: * 一个函数里面又调用了另外一个函数,这就是所谓的函数嵌套调用![函数嵌套调用] ![](https://img.kancloud.cn/1f/5f/1f5f2d23730a8915d9e2bf311257c701_1802x1116.png) * 如果函数A中,调用了另外一个函数B,那么先把函数B中的任务都执行完毕之后才会回到上次 函数A执行的位置