Sss123057057 发表于 2021-2-25 12:39:34

5. 请问如何访问 funIn() 呢?

5. 请问如何访问 funIn() 呢?
def funOut():
    def funIn():
      print('宾果!你成功访问到我啦!')
    return funIn
why
funOut()()
宾果!你成功访问到我啦!

逃兵 发表于 2021-2-25 13:19:14

def funOut():
    def funIn():
      print('宾果!你成功访问到我啦!')
    return funIn

函数funOut()的返回结果是funIn

funOut()相当于funIn

funOut()()相当于funIn()

funIn()会执行

print('宾果!你成功访问到我啦!')
页: [1]
查看完整版本: 5. 请问如何访问 funIn() 呢?