在函数体内定义新函数
name = 'jack' def change_name1(): name = 'jack1' def change_name2(): #内部定义的函数相当于内部变量,只可内部调用 name = 'jack2' print("第3层打印",name) change_name2() #调用内层函数 print("第2层打印",name) change_name1() print("最外层打印",name)