闭包 python

 一般,不能给外部作用域内的变量赋值,所以这里factor=factor+1会报错,需要在前面加上nonlocal

posted on 2023-04-21 17:19  jun_li123  阅读(18)  评论(0)    收藏  举报

导航