#闭包函数def multiplier(factor): def multiplyByFactory(number): return number*factor return multiplyByFactorydouble= multiplier(2)print(double(5))print(multiplier(12)(2))
result:
1024
本文共 256 字,大约阅读时间需要 1 分钟。
#闭包函数def multiplier(factor): def multiplyByFactory(number): return number*factor return multiplyByFactorydouble= multiplier(2)print(double(5))print(multiplier(12)(2))
result:
1024
转载于:https://www.cnblogs.com/lianghong881018/p/11081112.html